hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Location based RedirectStrategy
Date Mon, 16 Jan 2017 16:45:08 GMT
On Mon, 2017-01-16 at 13:22 +0100, Lucas Ventura Carro wrote:
> I wanted to develop an specific RedirectStrategy, which will accept
> the
> redirect based on the location URI returned in response.
> 
> So my idea was to override the 'isRedirected' method and, retrieve
> the URI
> with 'getLocationURI', decide redirection based on this value and a
> fixed
> set -- as method 'isRedirectable' doesn't fit my needs.
> 
> But when reviewing the code from
> DefaultRedirectStrategy.getLocation[1]
> I've realized that each time is called, it will store the URI in the
> current request context.
> Is this correct? Should not this be done on the caller method
> 'getRedirect'
> instead? As 'getLocation' seems more calculating, than doing the
> redirection itself.
> 
>     [1]:
> https://hc.apache.org/httpcomponents-client-ga/httpclient/xref/org/ap
> ache/http/impl/client/DefaultRedirectStrategy.html#122
> 
> --
> Lucas

Hi Lucas 

You are right. #getRedirect might be a better place for circular
redirect detection logic. Feel free to raise a JIRA with a change
request or raise PR at GitHub or both.

Oleg 

---------------------------------------------------------------------
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