How can I avoid circular redirect using HttpClient 4.1.1. As I am getting the error like this:-
executing requestGET http://home.somehost.com/Mynet/pages/cHo
I faced this issue while spring version upgrade, the context is not initialized properly in my case.
In org.apache.http.impl.client.DefaultRedirectStrategy
:
RedirectLocations redirectLocations = (RedirectLocations) clientContext.getAttribute(
HttpClientContext.REDIRECT_LOCATIONS);
The value of the clientContext
should be basicHttpContext
, but Spring Web
(4.3.x.RELEASE) is initializing the context in:
org.springframework.http.client.HttpComponentsClientHttpRequest.executeInternal();
The value of clientContext is changing, which results in circular redirect error. The Spring Web (3.2.x.RELEASE) don't initialize the context and value will be null.