hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalnichevski, Oleg" <oleg.kalnichev...@bearingpoint.com>
Subject RE: PostMethod.setFollowRedirects(true); -> do nothing
Date Mon, 19 Jan 2004 14:34:58 GMT

Hi Jean-Rémioyage,

POST methods _may_ not be redirected. When a web server responds with a redirect status code
to a POST request, the agent should execute an HTTP GET against the url location specified
in the POST response. Currently HttpClient is not able to do it automatically, but it is not
very difficult to work this limitation around. Please refer to the 'Handling Redirects' section
of the document below for details:


I hope this helps


-----Original Message-----
From: JEAN REMI LECQ [mailto:jrlecq@easyvoyage.fr]
Sent: Monday, January 19, 2004 15:27
To: commons-httpclient-dev@jakarta.apache.org
Subject: PostMethod.setFollowRedirects(true); -> do nothing

Sorry for my english ! I will make short to be sure you anderstand me...
I read a big part of the mailing list archive, but i do not find a solution
by now.

I encounter difficulties to make a redirection after a POST Method:

Error message :
16 janv. 2004 18:52:46 org.apache.commons.httpclient.HttpMethodBase
INFO: Redirect requested but followRedirects is disabled

my code :

String source="";
PostMethod methode = new PostMethod(URL);
methode.setRequestBody(data);		// data is like in tutorial : NameValuePair[]
	System.out.println("FollowRedirects TRUE");
	System.out.println("FollowRedirects FALSE");
String redirectLocation=null;
Header locationHeader = methode.getResponseHeader("location");
if (locationHeader != null) {
	redirectLocation = locationHeader.getValue();
} else {
	System.out.println("ERROR : 01");
	GetMethod getMeth=new GetMethod(redirectLocation);

for information, this part :
>if(methode.getFollowRedirects()) System.out.println("FollowRedirects
>else System.out.println("FollowRedirects FALSE");
always return FALSE !

If anybody has any idea what I am doing wrong, I'd be very pleased if he/she
told me :-)



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

The information in this email is confidential and may be legally
privileged.  Access to this email by anyone other than the
intended addressee is unauthorized.  If you are not the intended
recipient of this message, any review, disclosure, copying,
distribution, retention, or any action taken or omitted to be taken
in reliance on it is prohibited and may be unlawful.  If you are not
the intended recipient, please reply to or forward a copy of this
message to the sender and delete the message, any attachments,
and any copies thereof from your system.

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

View raw message