hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Josh Gordineer <joshg...@gmail.com>
Subject Re: Redirect on POST with a custom redirect handler?
Date Thu, 08 Jul 2010 17:27:07 GMT
Thanks Sam.  We don't control the target server so looks like I'll be doing
manual redirect following.

--Josh

On Wed, Jul 7, 2010 at 4:25 PM, <samcrawford@gmail.com> wrote:

> If you know/control the behaviour of the target server you can use the
> expect-continue handshake (google for it). HttpClient supports this.
>
> If not, I'd disable following of redirects (which will result in a GET, as
> you rightly say) and write a small bit of code to capture the response code
> and loop until we got a 200 (or a limit was reached).
>
> Thanks
>
> Sam
>
> -----Original Message-----
> From: Josh Gordineer <joshgord@gmail.com>
> Date: Wed, 7 Jul 2010 16:14:21
> To: <httpclient-users@hc.apache.org>
> Reply-To: "HttpClient User Discussion" <httpclient-users@hc.apache.org>
> Subject: Redirect on POST with a custom redirect handler?
>
> I'm looking for a way to handle a redirect on POST, obviously HttpClient
> doesn't handle them automatically.
>
> "HttpClient handles all types of redirects automatically, except those
> explicitly prohibited by the HTTP specification as requiring user
> intervention. See Other (status code 303) redirects on POST and PUT
> requests
> are converted to GET requests as required by the HTTP specification."
>
>
> http://hc.apache.org/httpcomponents-client/tutorial/html/httpagent.html#d4e1199
>
> The above states that the requests are automatically converted to GETs.  I
> was wondering if that logic to convert the requests to GETs exists in a
> place where I can customize such as a custom RedirectHandler or is the best
> approach to turn off automatic redirects and write custom logic to handle
> each redirect response?
>
> Thanks in advance..
>
> --Josh
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message