Apache HttpComponents: org.apache.http.client.ClientProtocolException

前端 未结 1 808
耶瑟儿~
耶瑟儿~ 2021-01-23 08:27

So I use apache HttpComponents to handle http request in java. Now I want to reuse the DefaultHttpClient, what should be possible accoarding to this example: http:/

相关标签:
1条回答
  • 2021-01-23 09:21

    This is likely due to a recent bug in the v4.2 BasicClientConnectionManager affecting cross site redirects. See http://issues.apache.org/jira/browse/HTTPCLIENT-1193.

    According to the maintainer, one temporary workaround is to use SingleClientConnManager or PoolingClientConnectionManager. Perhaps something like this:

    ClientConnectionManager connManager = new PoolingClientConnectionManager();
    DefaultHttpClient httpclient = new DefaultHttpClient(connManager);
    ...
    
    0 讨论(0)
提交回复
热议问题