Hi,
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
processRedirectResponse
INFO: Redirect requested but followRedirects is disabled
*************************************************************

my code :

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

for information, this part :
>if(methode.getFollowRedirects()) System.out.println("FollowRedirects
TRUE");
>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 :-)

Cordialement,

Jean-Rémioyage.fr


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to