Avoid Circular Redirect using HttpClient 4.1.1

前端 未结 6 593
花落未央
花落未央 2020-12-10 02:39

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         


        
6条回答
  •  时光取名叫无心
    2020-12-10 03:09

    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.

提交回复
热议问题