
Untitled
By: a guest on
Aug 10th, 2012 | syntax:
None | size: 0.91 KB | hits: 14 | expires: Never
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.0</version>
</dependency>
===========================================
IList<string> arrayOfUrls; // fille this up
MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
HttpConnectionManagerParams params = new HttpConnectionManagerParams();
params.setConnectionTimeout(20);
params.setDefaultMaxConnectionsPerHost(20);
params.setMaxTotalConnections(10);
connectionManager.setParams(params);
HttpClient client = new HttpClient(connectionManager);
foreach url in arrayOfUrls {
GetMethod get = new GetMethod(url);
int returnCode = client.executeMethod(method);
if(returnCode == 200)
{
String location=get.getResponseHeader("location").getValue();
}
}