Question

Is there a way to make a custom redirection handler which tells the Apache HttpClient where i want to be redirected before the redirection occurs, after a post method execution? This because i get an error in the response page and my guess is this is due to a relative redirection, that's not interpreted correctly. Thank you.

Was it helpful?

Solution

Not sure what you mean by 'redirected before the redirection occurs', but you can create your own redirection handler and replace the default one. Then you can handle the Location header however you like. In any case if the default one doesn't handle it correctly, it most likely some server misconfiguration. Here's the interface an the default implementation for reference:

http://developer.android.com/reference/org/apache/http/client/RedirectHandler.html

http://developer.android.com/reference/org/apache/http/impl/client/DefaultRedirectHandler.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top