In My App , I POST a xml file to the server , but sometimes the server will send back 302 and then redirect .
However , after the redirecting the method become GET , not POST, and my data in xml file can't deliver to server.
And finally the status code I got is 404.
Is there some way to process the redirect by myself ? Can I do something when the redirecting is happening?
Anyone can help? THX.!
From RFC 2616:
If the 302 status code is received in response to a request other than GET or HEAD, the user agent MUST NOT automatically redirect the request unless it can be confirmed by the user, since this might change the conditions under which the request was issued.
Are you sure your server isn't using the 'POST, redirect, GET' idiom?
You can disable automatic following of redirects in Apache HTTP client. For example:
_httpClient = new DefaultHttpClient();
_httpClient.getParams().setParameter(
ClientPNames.HANDLE_REDIRECTS, Boolean.FALSE);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With