commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adrian Sutton" <adrian.sut...@ephox.com>
Subject RE: [HttpClient] Post may not be redirected
Date Mon, 31 May 2004 21:18:01 GMT
Hi John,
The HTTP spec is very clear on this - POST requests *must* not be
redirected without user intervention.  As such HttpClient doesn't
automatically follow redirects with the PostMethod.  Even if it did that
wouldn't be the behaviour you are after anyway.  What IE and Mozilla do
when they get a redirect from a POST request is send a GET request to
the redirect URL instead of sending the POST again as they should (after
confirming with the user).  With the 2.0 architecture this behaviour
would not be possible in HttpClient even if we wanted to implement it,
however it is simple to implement yourself.  Take a look at
http://jakarta.apache.org/commons/httpclient/redirects.html  for
information on handling redirects that HttpClient can't or doesn't
handle.

Regards,

Adrian Sutton.

-----Original Message-----
From: John Patterson [mailto:dev_johnpatterson@hotmail.com] 
Sent: Tuesday, 1 June 2004 3:20 AM
To: Jakarta Commons Users List
Subject: [HttpClient] Post may not be redirected

When I try to set PostMethod.setFollowRedirects(true) an exception is
thrown
stating that this is not allowed with "Entity Enclosing requests".
However,
the server that I access does return a 302 for POST requests.  Again,
both
IE and Mozilla allow this so it might be a good idea to change this
behaviour.  Perhaps it could be a configurable HttpMethodParam.

John.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message