hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From motital74 <moti...@gmail.com>
Subject Re: POST response with status 302 doesn't redirect
Date Thu, 04 Nov 2010 19:11:26 GMT

Ryan, thanks again

I can find the DefaultRedirectStrategy as part of the GA.

I did implement the handler:
public URI getLocationURI(HttpResponse httpResponse, HttpContext
httpContext) throws ProtocolException {
                System.out.println("=======================getLocationURI");
                Header[] headers = httpResponse.getHeaders("Location");
                if (headers != null && headers.length > 0) {
                    try {
                        System.out.println(""==============getLocationURI
return" + headers[0].getValue());
                        return new URI(headers[0].getValue());
                    } catch (URISyntaxException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println("=======================getLocationURI
return null");
                return null;
            }

In my case i see the return log with the correct URI


Ryan Smith-10 wrote:
> 
> 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?
> 


-- 
View this message in context: http://old.nabble.com/POST-response-with-status-302-doesn%27t-redirect-tp30134484p30135246.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
View raw message