use of org.apache.http.params.HttpParams in project SeaStar by 13120241790.
the class SyncHttpClient method setMaxConnections.
/**
* Sets maximum limit of parallel connections
*
* @param maxConnections
* maximum parallel connections, must be at least 1
*/
public void setMaxConnections(int maxConnections) {
if (maxConnections < 1)
maxConnections = DEFAULT_MAX_CONNECTIONS;
this.maxConnections = maxConnections;
final HttpParams httpParams = this.httpClient.getParams();
ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(this.maxConnections));
}
use of org.apache.http.params.HttpParams in project SeaStar by 13120241790.
the class SyncHttpClient method setProxy.
/**
* Sets the Proxy by it's hostname and port
*
* @param hostname
* the hostname (IP or DNS name)
* @param port
* the port number. -1 indicates the scheme default port.
*/
public void setProxy(String hostname, int port) {
final HttpHost proxy = new HttpHost(hostname, port);
final HttpParams httpParams = this.httpClient.getParams();
httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
}
use of org.apache.http.params.HttpParams in project nhin-d by DirectProject.
the class HttpClientFactory method createHttpClient.
/**
* Creates an HttpClient with the default connection timeout and SO timeout.
* @return The HTTP client.
*/
public static HttpClient createHttpClient() {
final HttpClient client = new DefaultHttpClient(conMgr);
final HttpParams httpParams = client.getParams();
HttpConnectionParams.setConnectionTimeout(httpParams, DEFAULT_CON_TIMEOUT);
HttpConnectionParams.setSoTimeout(httpParams, DEFAULT_SO_TIMEOUT);
return client;
}
use of org.apache.http.params.HttpParams in project nhin-d by DirectProject.
the class HttpClientFactory method createHttpClient.
/**
* Creates an HttpClient with a specific connection timeout and SO timeout.
* @return The HTTP client.
*/
public static HttpClient createHttpClient(int conTimeOut, int soTimeout) {
final HttpClient client = new DefaultHttpClient(conMgr);
final HttpParams httpParams = client.getParams();
HttpConnectionParams.setConnectionTimeout(httpParams, conTimeOut);
HttpConnectionParams.setSoTimeout(httpParams, soTimeout);
return client;
}
use of org.apache.http.params.HttpParams in project xUtils by wyouflf.
the class HttpUtils method configSoTimeout.
public HttpUtils configSoTimeout(int timeout) {
final HttpParams httpParams = this.httpClient.getParams();
HttpConnectionParams.setSoTimeout(httpParams, timeout);
return this;
}
Aggregations