本文整理了Java中org.apache.commons.httpclient.HttpClient.setHostConfiguration()
方法的一些代码示例,展示了HttpClient.setHostConfiguration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HttpClient.setHostConfiguration()
方法的具体详情如下:
包路径:org.apache.commons.httpclient.HttpClient
类名称:HttpClient
方法名:setHostConfiguration
[英]Assigns the HostConfiguration to use with the HttpClient.
[中]分配要与HttpClient一起使用的主机配置。
代码示例来源:origin: elastic/elasticsearch-hadoop
client.setHostConfiguration(hostConfig);
代码示例来源:origin: de.julielab/dragontool
public void setHost(String host, int port, String charSet){
HostConfiguration hostConfig;
this.defaultCharSet=charSet;
hostConfig=http.getHostConfiguration();
hostConfig.setHost(host,port);
http.setHostConfiguration(hostConfig);
}
代码示例来源:origin: net.sourceforge/akismet-java
/**
* Sets proxy configuration information. This method must be called before
* any calls to the API if you require proxy configuration.
*
* @param proxyHost Proxy host
* @param proxyPort Proxy port
*/
public void setProxyConfiguration(String proxyHost, int proxyPort) {
HostConfiguration hostConfiguration = new HostConfiguration();
hostConfiguration.setProxy(proxyHost, proxyPort);
httpClient.setHostConfiguration(hostConfiguration);
}
代码示例来源:origin: net.sf.delicious-java/delicious
/**
* Sets proxy configuration information. This method must be called before
* any calls to the API if you require proxy configuration.
*
* @param proxyHost Proxy host
* @param proxyPort Proxy port
* @since 1.1
*/
public void setProxyConfiguration(String proxyHost, int proxyPort) {
HostConfiguration hostConfiguration = new HostConfiguration();
hostConfiguration.setProxy(proxyHost, proxyPort);
httpClient.setHostConfiguration(hostConfiguration);
}
代码示例来源:origin: org.netpreserve.commons/commons-web
public ApacheHttp31SLRFactory() {
connectionManager = new MultiThreadedHttpConnectionManager();
//connectionManager = new ThreadLocalHttpConnectionManager();
hostConfiguration = new HostConfiguration();
HttpClientParams params = new HttpClientParams();
http = new HttpClient(params,connectionManager);
http.setHostConfiguration(hostConfiguration);
}
代码示例来源:origin: iipc/openwayback
/**
*
*/
public Http11BlockLoader() {
connectionManager = new MultiThreadedHttpConnectionManager();
hostConfiguration = new HostConfiguration();
HttpClientParams params = new HttpClientParams();
// params.setParameter(HttpClientParams.RETRY_HANDLER, new NoRetryHandler());
http = new HttpClient(params,connectionManager);
http.setHostConfiguration(hostConfiguration);
}
代码示例来源:origin: iipc/webarchive-commons
public ApacheHttp31SLRFactory() {
connectionManager = new MultiThreadedHttpConnectionManager();
//connectionManager = new ThreadLocalHttpConnectionManager();
hostConfiguration = new HostConfiguration();
HttpClientParams params = new HttpClientParams();
http = new HttpClient(params,connectionManager);
http.setHostConfiguration(hostConfiguration);
}
代码示例来源:origin: org.netpreserve.commons/webarchive-commons
public ApacheHttp31SLRFactory() {
connectionManager = new MultiThreadedHttpConnectionManager();
//connectionManager = new ThreadLocalHttpConnectionManager();
hostConfiguration = new HostConfiguration();
HttpClientParams params = new HttpClientParams();
http = new HttpClient(params,connectionManager);
http.setHostConfiguration(hostConfiguration);
}
代码示例来源:origin: org.netpreserve.openwayback/openwayback-core
/**
*
*/
public Http11BlockLoader() {
connectionManager = new MultiThreadedHttpConnectionManager();
hostConfiguration = new HostConfiguration();
HttpClientParams params = new HttpClientParams();
// params.setParameter(HttpClientParams.RETRY_HANDLER, new NoRetryHandler());
http = new HttpClient(params,connectionManager);
http.setHostConfiguration(hostConfiguration);
}
代码示例来源:origin: de.julielab/dragontool
public HttpUtil(String host, int port, String charSet) {
HostConfiguration hostConfig;
buf=new byte[1024*1024];
this.lastCharSet =null;
this.autoRefresh =false;
this.defaultCharSet =charSet;
http=new HttpClient();
hostConfig=new HostConfiguration();
hostConfig.setHost(host,port);
http.setHostConfiguration(hostConfig);
setSocketTimeout(10000);
setConnectionTimeout(10000);
}
代码示例来源:origin: iipc/openwayback
/**
*
*/
public ArcRemoteLiveWebCache() {
connectionManager = new MultiThreadedHttpConnectionManager();
hostConfiguration = new HostConfiguration();
HttpClientParams params = new HttpClientParams();
params.setParameter(HttpClientParams.RETRY_HANDLER, new NoRetryHandler());
http = new HttpClient(params,connectionManager);
http.setHostConfiguration(hostConfiguration);
}
代码示例来源:origin: org.alfresco/alfresco-repository
public BitlyUrlShortenerImpl()
{
httpClient = new HttpClient();
httpClient.setHttpConnectionManager(new MultiThreadedHttpConnectionManager());
HostConfiguration hostConfiguration = new HostConfiguration();
hostConfiguration.setHost("api-ssl.bitly.com", 443, Protocol.getProtocol("https"));
httpClient.setHostConfiguration(hostConfiguration);
}
代码示例来源:origin: iipc/openwayback
/**
* StdRemoteLiveWebCache constructor initializes and configures connection objects.
*/
public StdRemoteLiveWebCache()
{
connectionManager = new MultiThreadedHttpConnectionManager();
hostConfiguration = new HostConfiguration();
HttpClientParams params = new HttpClientParams();
params.setParameter( HttpClientParams.RETRY_HANDLER,
new NoRetryHandler() );
httpClient = new HttpClient( params, connectionManager );
httpClient.setHostConfiguration( hostConfiguration );
}
代码示例来源:origin: org.netpreserve.openwayback/openwayback-core
/**
*
*/
public ArcRemoteLiveWebCache() {
connectionManager = new MultiThreadedHttpConnectionManager();
hostConfiguration = new HostConfiguration();
HttpClientParams params = new HttpClientParams();
params.setParameter(HttpClientParams.RETRY_HANDLER, new NoRetryHandler());
http = new HttpClient(params,connectionManager);
http.setHostConfiguration(hostConfiguration);
}
代码示例来源:origin: Alfresco/alfresco-repository
public BitlyUrlShortenerImpl()
{
httpClient = new HttpClient();
httpClient.setHttpConnectionManager(new MultiThreadedHttpConnectionManager());
HostConfiguration hostConfiguration = new HostConfiguration();
hostConfiguration.setHost("api-ssl.bitly.com", 443, Protocol.getProtocol("https"));
httpClient.setHostConfiguration(hostConfiguration);
}
代码示例来源:origin: org.netpreserve.openwayback/openwayback-core
/**
* StdRemoteLiveWebCache constructor initializes and configures connection objects.
*/
public StdRemoteLiveWebCache()
{
connectionManager = new MultiThreadedHttpConnectionManager();
hostConfiguration = new HostConfiguration();
HttpClientParams params = new HttpClientParams();
params.setParameter( HttpClientParams.RETRY_HANDLER,
new NoRetryHandler() );
httpClient = new HttpClient( params, connectionManager );
httpClient.setHostConfiguration( hostConfiguration );
}
代码示例来源:origin: net.exogeni.orca.core/shirako
@Override
public void afterPropertiesSet() {
HttpClient hc = getHttpClient();
NullHostConfiguration nhc = new NullHostConfiguration(hc.getHostConfiguration());
hc.setHostConfiguration(nhc);
if (getCredentials() != null) {
hc.getState().setCredentials(getAuthScope(), getCredentials());
hc.getParams().setAuthenticationPreemptive(true);
}
expiryTimer.schedule(new ConnectionExpiryTask(),
CONNECTION_EXPIRY_MILLISECONDS,
CONNECTION_EXPIRY_MILLISECONDS);
}
代码示例来源:origin: takeseem/diamond
private void initHttpClient() {
HostConfiguration hostConfiguration = new HostConfiguration();
SimpleHttpConnectionManager connectionManager = new SimpleHttpConnectionManager();
connectionManager.closeIdleConnections(5000L);
HttpConnectionManagerParams params = new HttpConnectionManagerParams();
params.setStaleCheckingEnabled(diamondConfigure.isConnectionStaleCheckingEnabled());
params.setConnectionTimeout(diamondConfigure.getConnectionTimeout());
connectionManager.setParams(params);
configHttpClient = new HttpClient(connectionManager);
configHttpClient.setHostConfiguration(hostConfiguration);
}
代码示例来源:origin: org.alfresco/alfresco-core
protected HttpClient getHttpsClient(String httpsHost, int httpsPort)
{
// Configure a custom SSL socket factory that will enforce mutual authentication
HttpClient httpClient = constructHttpClient();
HttpHostFactory hostFactory = new HttpHostFactory(new Protocol("https", sslSocketFactory, httpsPort));
httpClient.setHostConfiguration(new HostConfigurationWithHostFactory(hostFactory));
httpClient.getHostConfiguration().setHost(httpsHost, httpsPort, "https");
return httpClient;
}
代码示例来源:origin: deas/alfresco
protected HttpClient getHttpsClient()
{
// Configure a custom SSL socket factory that will enforce mutual authentication
HttpClient httpClient = constructHttpClient();
HttpHostFactory hostFactory = new HttpHostFactory(new Protocol("https", sslSocketFactory, sslPort));
httpClient.setHostConfiguration(new HostConfigurationWithHostFactory(hostFactory));
httpClient.getHostConfiguration().setHost(host, sslPort, "https");
return httpClient;
}
内容来源于网络,如有侵权,请联系作者删除!