client.setHostConfiguration(hostConfig);
public void setHost(String host, int port, String charSet){ HostConfiguration hostConfig; this.defaultCharSet=charSet; hostConfig=http.getHostConfiguration(); hostConfig.setHost(host,port); http.setHostConfiguration(hostConfig); }
/** * 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); }
/** * 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); }
public ApacheHttp31SLRFactory() { connectionManager = new MultiThreadedHttpConnectionManager(); //connectionManager = new ThreadLocalHttpConnectionManager(); hostConfiguration = new HostConfiguration(); HttpClientParams params = new HttpClientParams(); http = new HttpClient(params,connectionManager); http.setHostConfiguration(hostConfiguration); }
/** * */ 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); }
public ApacheHttp31SLRFactory() { connectionManager = new MultiThreadedHttpConnectionManager(); //connectionManager = new ThreadLocalHttpConnectionManager(); hostConfiguration = new HostConfiguration(); HttpClientParams params = new HttpClientParams(); http = new HttpClient(params,connectionManager); http.setHostConfiguration(hostConfiguration); }
public ApacheHttp31SLRFactory() { connectionManager = new MultiThreadedHttpConnectionManager(); //connectionManager = new ThreadLocalHttpConnectionManager(); hostConfiguration = new HostConfiguration(); HttpClientParams params = new HttpClientParams(); http = new HttpClient(params,connectionManager); http.setHostConfiguration(hostConfiguration); }
/** * */ 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); }
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); }
/** * */ 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); }
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); }
/** * 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 ); }
/** * */ 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); }
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); }
/** * 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 ); }
@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); }
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); }
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; }
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; }