Automatic redirection with Apache HttpClient

I am using apache HttpClient with my Android 4.2 app. I have a requirement to support automatic request redirection. I am setting the auto-redirect flag in the request like this:

HttpClientParams.setRedirecting(this.request.getParams(), isAutoRedirectEnabled);

      

Requests redirect fine as long as the request is a simple GET. When I send a POST request with a specific payload, the first request is sent as a POST, but when those requests are redirected, the auto-redirect logic sends a GET request to the redirected url.

I tried setting up the HttpRedirectHandler to DefaultHttpClient and handling the retry manually, but this is a very hacky way to do it and I already found problems with it. Is there another way?

+3
android httpclient


source to share


No one has answered this question yet

See similar questions:

3
How to handle redirection in post method using HttpClient?

or similar:

13
Android HttpClient not using system proxy settings
nine
Android HttpClient performance
2
Apache HttpClient AD FS and SAML claims
1
Apache HttpClient: location of redirected urls
0
Android message and getting data using apache
0
Apache HTTPClient gets CookieManager when using request
0
Redirect HTTPClient using POST method
0
HttpClient relative redirection handling
0
Enable auto redirect POST request with HttpClient
0
HTTPClient - HTTP GET broken with C # anchor in redirect url



All Articles
Loading...
X
Show
Funny
Dev
Pics