【发布时间】:2014-10-01 09:07:36
【问题描述】:
我有以下代码来使用 Apache HTTP 客户端调用 REST API 方法。但是,使用上述客户端只能发送两个并行请求。 有没有设置最大连接数的参数?
HttpPost post = new HttpPost(resourcePath);
addPayloadJsonString(payload, post);//set a String Entity
setAuthHeader(post);// set Authorization: Basic header
try {
return httpClient.execute(post);
} catch (IOException e) {
String errorMsg = "Error while executing POST statement";
log.error(errorMsg, e);
throw new RestClientException(errorMsg, e);
}
我正在使用的罐子如下,
org.apache.httpcomponents.httpclient_4.3.5.jar
org.apache.httpcomponents.httpcore_4.3.2.jar
【问题讨论】:
标签: apache rest http httpclient