当前位置: 首页>>代码示例>>Java>>正文


Java HttpRoutePlanner类代码示例

本文整理汇总了Java中org.apache.http.conn.routing.HttpRoutePlanner的典型用法代码示例。如果您正苦于以下问题:Java HttpRoutePlanner类的具体用法?Java HttpRoutePlanner怎么用?Java HttpRoutePlanner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HttpRoutePlanner类属于org.apache.http.conn.routing包,在下文中一共展示了HttpRoutePlanner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: DefaultRequestDirector

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
@Deprecated
public DefaultRequestDirector(
        final HttpRequestExecutor requestExec,
        final ClientConnectionManager conman,
        final ConnectionReuseStrategy reustrat,
        final ConnectionKeepAliveStrategy kastrat,
        final HttpRoutePlanner rouplan,
        final HttpProcessor httpProcessor,
        final HttpRequestRetryHandler retryHandler,
        final RedirectHandler redirectHandler,
        final AuthenticationHandler targetAuthHandler,
        final AuthenticationHandler proxyAuthHandler,
        final UserTokenHandler userTokenHandler,
        final HttpParams params) {
    this(LogFactory.getLog(DefaultRequestDirector.class),
            requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler,
            new DefaultRedirectStrategyAdaptor(redirectHandler),
            new AuthenticationStrategyAdaptor(targetAuthHandler),
            new AuthenticationStrategyAdaptor(proxyAuthHandler),
            userTokenHandler,
            params);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:DefaultRequestDirector.java

示例2: InternalHttpClient

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
public InternalHttpClient(
        final ClientExecChain execChain,
        final HttpClientConnectionManager connManager,
        final HttpRoutePlanner routePlanner,
        final Lookup<CookieSpecProvider> cookieSpecRegistry,
        final Lookup<AuthSchemeProvider> authSchemeRegistry,
        final CookieStore cookieStore,
        final CredentialsProvider credentialsProvider,
        final RequestConfig defaultConfig,
        final List<Closeable> closeables) {
    super();
    Args.notNull(execChain, "HTTP client exec chain");
    Args.notNull(connManager, "HTTP connection manager");
    Args.notNull(routePlanner, "HTTP route planner");
    this.execChain = execChain;
    this.connManager = connManager;
    this.routePlanner = routePlanner;
    this.cookieSpecRegistry = cookieSpecRegistry;
    this.authSchemeRegistry = authSchemeRegistry;
    this.cookieStore = cookieStore;
    this.credentialsProvider = credentialsProvider;
    this.defaultConfig = defaultConfig;
    this.closeables = closeables;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:25,代码来源:InternalHttpClient.java

示例3: setup

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void setup() throws Exception {
    execChain = Mockito.mock(ClientExecChain.class);
    connManager = Mockito.mock(HttpClientConnectionManager.class);
    routePlanner = Mockito.mock(HttpRoutePlanner.class);
    cookieSpecRegistry = Mockito.mock(Lookup.class);
    authSchemeRegistry = Mockito.mock(Lookup.class);
    cookieStore = Mockito.mock(CookieStore.class);
    credentialsProvider = Mockito.mock(CredentialsProvider.class);
    defaultConfig = RequestConfig.custom().build();
    closeable1 = Mockito.mock(Closeable.class);
    closeable2 = Mockito.mock(Closeable.class);

    client = new InternalHttpClient(execChain, connManager, routePlanner,
            cookieSpecRegistry, authSchemeRegistry, cookieStore, credentialsProvider,
            defaultConfig, Arrays.asList(closeable1, closeable2));

}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:20,代码来源:TestInternalHttpClient.java

示例4: getRequestDirector

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
/** This method mainly exists to make the wrapper more testable. oh, apache's insanity. */
protected RequestDirector getRequestDirector(HttpRequestExecutor requestExec,
                                             ClientConnectionManager conman,
                                             ConnectionReuseStrategy reustrat,
                                             ConnectionKeepAliveStrategy kastrat,
                                             HttpRoutePlanner rouplan,
                                             HttpProcessor httpProcessor,
                                             HttpRequestRetryHandler retryHandler,
                                             RedirectHandler redirectHandler,
                                             AuthenticationHandler targetAuthHandler,
                                             AuthenticationHandler proxyAuthHandler,
                                             UserTokenHandler stateHandler,
                                             HttpParams params
) {
    return new DefaultRequestDirector(requestExec, conman, reustrat, kastrat, rouplan,
            httpProcessor, retryHandler, redirectHandler, targetAuthHandler, proxyAuthHandler,
            stateHandler, params);
}
 
开发者ID:triveous,项目名称:SoundcloudAPI,代码行数:19,代码来源:ApiWrapper.java

示例5: getRequestDirector

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
/** This method mainly exists to make the wrapper more testable. oh, apache's insanity. */
protected RequestDirector getRequestDirector(HttpRequestExecutor requestExec,
                                             ClientConnectionManager conman,
                                             ConnectionReuseStrategy reustrat,
                                             ConnectionKeepAliveStrategy kastrat,
                                             HttpRoutePlanner rouplan,
                                             HttpProcessor httpProcessor,
                                             HttpRequestRetryHandler retryHandler,
                                             RedirectHandler redirectHandler,
                                             AuthenticationHandler targetAuthHandler,
                                             AuthenticationHandler proxyAuthHandler,
                                             UserTokenHandler stateHandler,
                                             HttpParams params
) {
	return new DefaultRequestDirector(requestExec, conman, reustrat, kastrat, rouplan,
			httpProcessor, retryHandler, redirectHandler, targetAuthHandler, proxyAuthHandler,
			stateHandler, params);
}
 
开发者ID:EnteriseToolkit,项目名称:paperchains,代码行数:19,代码来源:ApiWrapper.java

示例6: createRequestFactory

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
public ClientHttpRequestFactory createRequestFactory(HttpProxyConfiguration httpProxyConfiguration, boolean
        trustSelfSignedCerts) {
    HttpClientBuilder httpClientBuilder = HttpClients.custom().useSystemProperties();

    if (trustSelfSignedCerts) {
        httpClientBuilder.setSslcontext(buildSslContext());
        httpClientBuilder.setHostnameVerifier(BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
    }

    if (httpProxyConfiguration != null) {
        HttpHost proxy = new HttpHost(httpProxyConfiguration.getProxyHost(), httpProxyConfiguration.getProxyPort());
        httpClientBuilder.setProxy(proxy);

        if (httpProxyConfiguration.isAuthRequired()) {
            BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
            credentialsProvider.setCredentials(
                    new AuthScope(httpProxyConfiguration.getProxyHost(), httpProxyConfiguration.getProxyPort()),
                    new UsernamePasswordCredentials(httpProxyConfiguration.getUsername(), httpProxyConfiguration
                            .getPassword()));
            httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
        }

        HttpRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy);
        httpClientBuilder.setRoutePlanner(routePlanner);
    }

    HttpClient httpClient = httpClientBuilder.build();
    HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);

    return requestFactory;
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:32,代码来源:RestUtil.java

示例7: createClientRequestDirector

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
/**
 * @deprecated (4.1) do not use
 */
@Deprecated
protected RequestDirector createClientRequestDirector(
        final HttpRequestExecutor requestExec,
        final ClientConnectionManager conman,
        final ConnectionReuseStrategy reustrat,
        final ConnectionKeepAliveStrategy kastrat,
        final HttpRoutePlanner rouplan,
        final HttpProcessor httpProcessor,
        final HttpRequestRetryHandler retryHandler,
        final RedirectHandler redirectHandler,
        final AuthenticationHandler targetAuthHandler,
        final AuthenticationHandler proxyAuthHandler,
        final UserTokenHandler userTokenHandler,
        final HttpParams params) {
    return new DefaultRequestDirector(
            requestExec,
            conman,
            reustrat,
            kastrat,
            rouplan,
            httpProcessor,
            retryHandler,
            redirectHandler,
            targetAuthHandler,
            proxyAuthHandler,
            userTokenHandler,
            params);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:32,代码来源:AbstractHttpClient.java

示例8: decorateRoutePlanner

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
private void decorateRoutePlanner(CrawlerHttpClient crawlerHttpClient) {
    HttpRoutePlanner routePlanner = crawlerHttpClient.getRoutePlanner();
    if (!(routePlanner instanceof ProxyBindRoutPlanner)) {
        log.warn("自定义了代理发生器,vscrawler的代理功能将不会生效");
        return;
    }

    VSCrawlerRoutePlanner vsCrawlerRoutePlanner = new VSCrawlerRoutePlanner((ProxyBindRoutPlanner) routePlanner,
            ipPool, proxyPlanner, this);
    crawlerHttpClient.setRoutePlanner(vsCrawlerRoutePlanner);

}
 
开发者ID:virjar,项目名称:vscrawler,代码行数:13,代码来源:CrawlerSession.java

示例9: RedirectExec

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
public RedirectExec(
        final ClientExecChain requestExecutor,
        final HttpRoutePlanner routePlanner,
        final RedirectStrategy redirectStrategy) {
    super();
    Args.notNull(requestExecutor, "HTTP client request executor");
    Args.notNull(routePlanner, "HTTP route planner");
    Args.notNull(redirectStrategy, "HTTP redirect strategy");
    this.requestExecutor = requestExecutor;
    this.routePlanner = routePlanner;
    this.redirectStrategy = redirectStrategy;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:13,代码来源:RedirectExec.java

示例10: getRoutePlanner

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
private HttpRoutePlanner getRoutePlanner() {
  proxyHostname = Strings.nullToEmpty(proxyHostname);
  if (proxyHostname.isEmpty()) {
    proxyEnabled = false;
  }
  if (proxyEnabled) {
    HttpHost proxy = new HttpHost(proxyHostname, proxyPort, proxyScheme);

    HttpRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy) {

      @Override
      public HttpRoute determineRoute(
              final HttpHost host,
              final HttpRequest request,
              final HttpContext context) throws HttpException {
        String hostname = host.getHostName();
        if (hostname.equals("127.0.0.1") || hostname.equalsIgnoreCase("localhost")) {
          // Return direct route
          return new HttpRoute(host);
        }
        return super.determineRoute(host, request, context);
      }
    };
    return routePlanner;
  }
  return null;
}
 
开发者ID:HPInc,项目名称:printos-device-api-example-java,代码行数:28,代码来源:HttpClientFactoryBean.java

示例11: AndroidHttpClient

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
private AndroidHttpClient(ClientConnectionManager paramClientConnectionManager, HttpParams paramHttpParams)
{
  this.delegate = new DefaultHttpClient(paramClientConnectionManager, paramHttpParams)
  {
    protected final RequestDirector createClientRequestDirector(HttpRequestExecutor paramAnonymousHttpRequestExecutor, ClientConnectionManager paramAnonymousClientConnectionManager, ConnectionReuseStrategy paramAnonymousConnectionReuseStrategy, ConnectionKeepAliveStrategy paramAnonymousConnectionKeepAliveStrategy, HttpRoutePlanner paramAnonymousHttpRoutePlanner, HttpProcessor paramAnonymousHttpProcessor, HttpRequestRetryHandler paramAnonymousHttpRequestRetryHandler, RedirectHandler paramAnonymousRedirectHandler, AuthenticationHandler paramAnonymousAuthenticationHandler1, AuthenticationHandler paramAnonymousAuthenticationHandler2, UserTokenHandler paramAnonymousUserTokenHandler, HttpParams paramAnonymousHttpParams)
    {
      return new ElegantRequestDirector(paramAnonymousHttpRequestExecutor, paramAnonymousClientConnectionManager, paramAnonymousConnectionReuseStrategy, paramAnonymousConnectionKeepAliveStrategy, paramAnonymousHttpRoutePlanner, paramAnonymousHttpProcessor, paramAnonymousHttpRequestRetryHandler, paramAnonymousRedirectHandler, paramAnonymousAuthenticationHandler1, paramAnonymousAuthenticationHandler2, paramAnonymousUserTokenHandler, paramAnonymousHttpParams);
    }
    
    protected final HttpContext createHttpContext()
    {
      BasicHttpContext localBasicHttpContext = new BasicHttpContext();
      localBasicHttpContext.setAttribute("http.authscheme-registry", getAuthSchemes());
      localBasicHttpContext.setAttribute("http.cookiespec-registry", getCookieSpecs());
      localBasicHttpContext.setAttribute("http.auth.credentials-provider", getCredentialsProvider());
      return localBasicHttpContext;
    }
    
    protected final BasicHttpProcessor createHttpProcessor()
    {
      BasicHttpProcessor localBasicHttpProcessor = super.createHttpProcessor();
      localBasicHttpProcessor.addRequestInterceptor(AndroidHttpClient.sThreadCheckInterceptor);
      localBasicHttpProcessor.addRequestInterceptor(new AndroidHttpClient.CurlLogger(AndroidHttpClient.this, (byte)0));
      return localBasicHttpProcessor;
    }
  };
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:28,代码来源:AndroidHttpClient.java

示例12: createRequestFactory

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
public static ClientHttpRequestFactory createRequestFactory(HttpProxyConfiguration httpProxyConfiguration, boolean trustSelfSignedCerts, boolean disableRedirectHandling) {
	HttpClientBuilder httpClientBuilder = HttpClients.custom().useSystemProperties();

	if (trustSelfSignedCerts) {
		httpClientBuilder.setSslcontext(buildSslContext());
		httpClientBuilder.setHostnameVerifier(BROWSER_COMPATIBLE_HOSTNAME_VERIFIER);
	}
	
	if (disableRedirectHandling) {
		httpClientBuilder.disableRedirectHandling();
	}

	if (httpProxyConfiguration != null) {
		HttpHost proxy = new HttpHost(httpProxyConfiguration.getProxyHost(), httpProxyConfiguration.getProxyPort());
		httpClientBuilder.setProxy(proxy);

		if (httpProxyConfiguration.isAuthRequired()) {
			BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
			credentialsProvider.setCredentials(
					new AuthScope(httpProxyConfiguration.getProxyHost(), httpProxyConfiguration.getProxyPort()),
					new UsernamePasswordCredentials(httpProxyConfiguration.getUsername(), httpProxyConfiguration.getPassword()));
			httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
		}

		HttpRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy);
		httpClientBuilder.setRoutePlanner(routePlanner);
	}

	HttpClient httpClient = httpClientBuilder.build();
	HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);

	return requestFactory;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:34,代码来源:RestUtils.java

示例13: expectedSendGridBeanWithProxyCreated

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
@Test
public void expectedSendGridBeanWithProxyCreated() {
	loadContext("spring.sendgrid.username:user", "spring.sendgrid.password:secret",
			"spring.sendgrid.proxy.host:localhost",
			"spring.sendgrid.proxy.port:5678");
	SendGrid sendGrid = this.context.getBean(SendGrid.class);
	CloseableHttpClient client = (CloseableHttpClient) ReflectionTestUtils
			.getField(sendGrid, "client");
	HttpRoutePlanner routePlanner = (HttpRoutePlanner) ReflectionTestUtils
			.getField(client, "routePlanner");
	assertThat(routePlanner, instanceOf(DefaultProxyRoutePlanner.class));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:13,代码来源:SendGridAutoConfigurationTests.java

示例14: __constructor__

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
public void __constructor__(
    HttpRequestExecutor requestExec,
    ClientConnectionManager conman,
    ConnectionReuseStrategy reustrat,
    ConnectionKeepAliveStrategy kastrat,
    HttpRoutePlanner rouplan,
    HttpProcessor httpProcessor,
    HttpRequestRetryHandler retryHandler,
    RedirectHandler redirectHandler,
    AuthenticationHandler targetAuthHandler,
    AuthenticationHandler proxyAuthHandler,
    UserTokenHandler userTokenHandler,
    HttpParams params) {
  __constructor__(
      LogFactory.getLog(DefaultRequestDirector.class),
      requestExec,
      conman,
      reustrat,
      kastrat,
      rouplan,
      httpProcessor,
      retryHandler,
      redirectHandler,
      targetAuthHandler,
      proxyAuthHandler,
      userTokenHandler,
      params);
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:29,代码来源:ShadowDefaultRequestDirector.java

示例15: DefaultRequestDirector

import org.apache.http.conn.routing.HttpRoutePlanner; //导入依赖的package包/类
public DefaultRequestDirector(
    final HttpRequestExecutor requestExec,
    final ClientConnectionManager conman,
    final ConnectionReuseStrategy reustrat,
    final ConnectionKeepAliveStrategy kastrat,
    final HttpRoutePlanner rouplan,
    final HttpProcessor httpProcessor,
    final HttpRequestRetryHandler retryHandler,
    final RedirectHandler redirectHandler,
    final AuthenticationHandler targetAuthHandler,
    final AuthenticationHandler proxyAuthHandler,
    final UserTokenHandler userTokenHandler,
    final HttpParams params) {
  this(LogFactory.getLog(DefaultRequestDirector.class),
      requestExec,
      conman,
      reustrat,
      kastrat,
      rouplan,
      httpProcessor,
      retryHandler,
      redirectHandler,
      targetAuthHandler,
      proxyAuthHandler,
      userTokenHandler,
      params);

}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:29,代码来源:DefaultRequestDirector.java


注:本文中的org.apache.http.conn.routing.HttpRoutePlanner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。