You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Roland Weber <ht...@dubioso.net> on 2007/02/19 22:39:36 UTC

[Resend] Re: Problem posting login information (ajax)

[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 <ht...@dubioso.net>
To: HttpClient User Discussion <ht...@jakarta.apache.org>
References: <00...@marcelo>
<45...@dubioso.net> <00...@marcelo>

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: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org