Java 类org.apache.http.impl.conn.ProxySelectorRoutePlanner 实例源码

项目:jira-dvcs-connector    文件:HttpClientProvider.java   
public HttpClientProvider()
{
    httpClient = SystemUtils.createHttpClient();

    HttpConnectionParams.setConnectionTimeout(httpClient.getParams(), DEFAULT_CONNECT_TIMEOUT);
    HttpConnectionParams.setSoTimeout(httpClient.getParams(), DEFAULT_SOCKET_TIMEOUT);

    ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(httpClient.getConnectionManager().getSchemeRegistry(), ProxySelector.getDefault());
    httpClient.setRoutePlanner(routePlanner);
    httpClient.setKeepAliveStrategy(new ConnectionKeepAliveStrategy(DEFAULT_CONNECTION_KEEP_ALIVE_DURATION));
    cachingHttpClient = new EtagCachingHttpClient(httpClient, createStorage());
}
项目:openbd-core    文件:cfHttpConnection.java   
private void setDefaultProxy() {
    HttpHost currentProxy = ( HttpHost )client.getParams().getParameter( ConnRoutePNames.DEFAULT_PROXY );

    if ( currentProxy == null ) {
        ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner( client.getConnectionManager().getSchemeRegistry(), ProxySelector.getDefault() );
        client.setRoutePlanner( routePlanner );
    }
}
项目:GloboDNS-Client    文件:GloboDns.java   
private static HttpClient newDefaultHttpClient(SSLSocketFactory socketFactory, HttpParams params, ProxySelector proxySelector) {
    SchemeRegistry registry = new SchemeRegistry();
    registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
    registry.register(new Scheme("https", socketFactory, 443));
    ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(params, registry);
    DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, params);
    httpClient.setHttpRequestRetryHandler(new DefaultHttpRequestRetryHandler(0, false));
    httpClient.setRoutePlanner(new ProxySelectorRoutePlanner(registry, proxySelector));
    return httpClient;
}
项目:InSpider    文件:HttpUtils.java   
public static DefaultHttpClient createHttpClient() {
    HttpParams httpParams = new BasicHttpParams();
    HttpConnectionParams.setConnectionTimeout(httpParams, 60000);// was 10000
    HttpConnectionParams.setSoTimeout(httpParams, 60000);// was 30000

    DefaultHttpClient httpClient = new DefaultHttpClient(httpParams);
    // http-proxy
    ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
            httpClient.getConnectionManager().getSchemeRegistry(),
            ProxySelector.getDefault());
    httpClient.setRoutePlanner(routePlanner);

    return httpClient;
}
项目:opennmszh    文件:NominatimGeocoderService.java   
public NominatimGeocoderService() {
    // Honor the JRE's HTTP proxy settings
    final ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
        m_httpClient.getConnectionManager().getSchemeRegistry(),
        ProxySelector.getDefault()
    );
    m_httpClient.setRoutePlanner(routePlanner);
}
项目:spring-restlet    文件:HttpClientHelper.java   
/**
 * Configures the HTTP client. By default, it try to set the retry handler.
 *
 * @param httpClient
 *            The HTTP client to configure.
 */
protected void configure(DefaultHttpClient httpClient) {
    if (getRetryHandler() != null) {
        try {
            HttpRequestRetryHandler retryHandler = (HttpRequestRetryHandler) Engine.loadClass(getRetryHandler()).newInstance();
            this.httpClient.setHttpRequestRetryHandler(retryHandler);
        } catch (Exception e) {
            getLogger().log(Level.WARNING, "An error occurred during the instantiation of the retry handler.", e);
        }
    }
    ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(httpClient.getConnectionManager().getSchemeRegistry(), ProxySelector
            .getDefault());
    httpClient.setRoutePlanner(routePlanner);
}
项目:SensorPlanningService    文件:SimpleHttpClient.java   
private void initProxyAwareClient() {
    ClientConnectionManager connectionManager = httpclient.getConnectionManager();
    SchemeRegistry schemeRegistry = connectionManager.getSchemeRegistry();
    ProxySelector defaultProxySelector = ProxySelector.getDefault();
    ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(schemeRegistry, defaultProxySelector);
    httpclient.setRoutePlanner(routePlanner);
    httpclient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, timeout);
}
项目:lams    文件:SystemDefaultHttpClient.java   
@Override
protected HttpRoutePlanner createHttpRoutePlanner() {
    return new ProxySelectorRoutePlanner(getConnectionManager().getSchemeRegistry(),
            ProxySelector.getDefault());
}
项目:purecloud-iot    文件:SystemDefaultHttpClient.java   
@Override
protected HttpRoutePlanner createHttpRoutePlanner() {
    return new ProxySelectorRoutePlanner(getConnectionManager().getSchemeRegistry(),
            ProxySelector.getDefault());
}
项目:BingAds-Java-SDK    文件:HttpClientWebServiceCaller.java   
private DefaultHttpClient createHttpClientWithProxy() {
    DefaultHttpClient client = new DefaultHttpClient();

    ProxySelector proxySelector = ProxySelector.getDefault();

    client.setRoutePlanner(new ProxySelectorRoutePlanner(client.getConnectionManager().getSchemeRegistry(), proxySelector));

    return client;
}