hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Smith <ryan.justin.sm...@gmail.com>
Subject Re: POST response with status 302 doesn't redirect
Date Thu, 04 Nov 2010 18:55:08 GMT
I am using 4.1-alpha2, in this version, you extend DefaultRedirectStrategy
and override the method isRedirected().  Inside that method, check for a
post method and a 302 or 301 and return true if so.  I use something like
this:

  boolean isRedirect = super.isRedirected(request, response, context);
  if (!isRedirect) {
        //  Then check for POST and 302 or 301.

Maybe post your code?


On Thu, Nov 4, 2010 at 2:37 PM, motital74 <motital@gmail.com> wrote:

>
> Thank you Ryan
> I looked after RedirectStrategy as part of 4.0.3 with no luck.
> I have implemented the RedirectHandler and got the foolowing Exception:
> Exception in thread "main" java.lang.IllegalArgumentException: Host name
> may
> not be null
>
> In the getLocationURI I return the URI from the response header (Location).
>
> Appreciate your help
>
>
> Ryan Smith-10 wrote:
> >
> > Redirecting POSTs breaks RFC standards.  You need to extend and implement
> > your own RedirectHandler/RedirectStrategy and tell HttpClient to use it
> > instead of the default one.
> >
> > hth.
> >
> > On Thu, Nov 4, 2010 at 1:45 PM, motital74 <motital@gmail.com> wrote:
> >
> >>
> >> Hello
> >>
> >> I am using httpclient 4.0.3 GA.
> >> I am trying to connect to a website using the http client which required
> >> POST request (https).
> >> The response HTTP status of the POST request is 302 (the location header
> >> as
> >> the URI).
> >> for some reason that I don't understand the http client doesn't redirect
> >> it.
> >> The expected result is GET METHOD with the redirect URI.
> >> Any Idea?
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/POST-response-with-status-302-doesn%27t-redirect-tp30134484p30134484.html
> >> Sent from the HttpClient-User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> >> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/POST-response-with-status-302-doesn%27t-redirect-tp30134484p30134949.html
> Sent from the HttpClient-User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

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