Use 4.0 version of httpclient

I want to update the httpclient version in my project. The project used http 3.1 jar, now I need to update version 4.0. I downloaded the repository from here

I changed most of the code, but got stuck on some api and method.I searched a lot, but could not find the equivalent of this, I describe below:

What is eqVivalent MultiThreadedHttpConnectionManager?

I found PoolingClientConnectionManager for httpClient 4.x, but it does not exist in version 4.0. here is my old code base for httpversion 3.1

MultiThreadedHttpConnectionManager connMgr = new MultiThreadedHttpConnectionManager(); m_client = new HttpClient(connMgr); /* * Maximum concurrent connections that are allowed to a given * domain/host */ m_client.getHttpConnectionManager() .getParams() .setMaxConnectionsPerHost( HostConfiguration.ANY_HOST_CONFIGURATION, maxConcurrentConnections); /* * * How long to wait before timing out on a http connection */ m_client.getHttpConnectionManager().getParams() .setConnectionTimeout(connectionTimeout); /* * How long to wait before timing out on a socket connection */ m_client.getParams().setSoTimeout(socketTimeout); 
+7
source share
1 answer

It seems like httpclient 4.0 used ThreadSafeClientConnManager , which is deprecated in favor of PoolingClientConnectionManager in version 4.2.

I found this in the following thread: Best practices for using HttpClient in a multi-threaded environment

0
source

All Articles