[resending, since the original post seemingly didn't make it to the list] -------- Original Message -------- Subject: Re: Problem posting login information (ajax) Date: Mon, 19 Feb 2007 20:37:44 +0100 From: Roland Weber <[EMAIL PROTECTED]> To: HttpClient User Discussion <[email protected]> References: <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Hello Marcelo, > I always send the parameters to the final url when posting data, That is wrong. If the server application expects the POST data at URL X and then sends you to URL Y after processing the posted data, you can't just post the data to URL Y and expect that to work. Please take the time to study the Client HTTP Programming Primer: http://wiki.apache.org/jakarta-httpclient/ForAbsoluteBeginners > Besides, when I set method.setFollowRedirects(true) and execute this > method, i receive an error: > java.lang.IllegalArgumentException: Entity enclosing requests cannot be > redirected without user intervention That is an error message from HttpClient... > and a statuscode 500. ...and that is a status code from the server. How do you get both at once? If an exception is thrown, you shouldn't get a status code!? Regarding the exception (and Michelle's question), see RFC 2616. Section 10.3 (http://rfc.net/rfc2616.html#s10.3): The action required MAY be carried out by the user agent without interaction with the user if and only if the method used in the second request is GET or HEAD. Section 10.3.3 (http://rfc.net/rfc2616.html#s10.3.3): 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 Section 10.3.8 (http://rfc.net/rfc2616.html#s10.3.8): If the 307 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 HttpClient will never interact with the user directly, and therefore is not allowed to follow such redirects automatically. cheers, Roland --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
