Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5182F200BFE for ; Mon, 16 Jan 2017 17:45:17 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 50195160B41; Mon, 16 Jan 2017 16:45:17 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BFF1B160B28 for ; Mon, 16 Jan 2017 17:45:16 +0100 (CET) Received: (qmail 36996 invoked by uid 500); 16 Jan 2017 16:45:16 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 36985 invoked by uid 99); 16 Jan 2017 16:45:15 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Jan 2017 16:45:15 +0000 Received: from ok2c (unknown [213.55.211.27]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 278A31A0329 for ; Mon, 16 Jan 2017 16:45:14 +0000 (UTC) Message-ID: <1484585108.8352.1.camel@apache.org> Subject: Re: Location based RedirectStrategy From: Oleg Kalnichevski To: HttpClient User Discussion Date: Mon, 16 Jan 2017 17:45:08 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.3-1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit archived-at: Mon, 16 Jan 2017 16:45:17 -0000 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