• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ClientExecChain类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: InternalHttpClient

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的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


示例2: decorateProtocolExec_uses_subspan_option_value_at_time_of_creation_not_time_of_execution

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
@DataProvider(value = {
    "true",
    "false"
}, splitBy = "\\|")
@Test
public void decorateProtocolExec_uses_subspan_option_value_at_time_of_creation_not_time_of_execution(
    boolean subspanOptionOn
) throws IOException, HttpException {
    // given
    builder = WingtipsHttpClientBuilder.create(subspanOptionOn);
    Span parentSpan = Tracer.getInstance().startRequestWithRootSpan("someParentSpan");

    SpanCapturingClientExecChain origCec = spy(new SpanCapturingClientExecChain());

    // when
    ClientExecChain result = builder.decorateProtocolExec(origCec);
    // Set builder's subspan option to the opposite of what it was when the ClientExecChain was decorated.
    builder.setSurroundCallsWithSubspan(!subspanOptionOn);

    // then
    // Even though the *builder's* subspan option has been flipped, the ClientExecChain should still execute with
    //      the subspan option value from when the ClientExecChain was originally decorated.
    verifyDecoratedClientExecChainPerformsTracingLogic(
        result, origCec, parentSpan, subspanOptionOn
    );
}
 
开发者ID:Nike-Inc,项目名称:wingtips,代码行数:27,代码来源:WingtipsHttpClientBuilderTest.java


示例3: CachingExec

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
public CachingExec(
        final ClientExecChain backend,
        final HttpCache cache,
        final CacheConfig config,
        final AsynchronousValidator asynchRevalidator) {
    super();
    Args.notNull(backend, "HTTP backend");
    Args.notNull(cache, "HttpCache");
    this.cacheConfig = config != null ? config : CacheConfig.DEFAULT;
    this.backend = backend;
    this.responseCache = cache;
    this.validityPolicy = new CacheValidityPolicy();
    this.responseGenerator = new CachedHttpResponseGenerator(this.validityPolicy);
    this.cacheableRequestPolicy = new CacheableRequestPolicy();
    this.suitabilityChecker = new CachedResponseSuitabilityChecker(this.validityPolicy, this.cacheConfig);
    this.conditionalRequestBuilder = new ConditionalRequestBuilder();
    this.responseCompliance = new ResponseProtocolCompliance();
    this.requestCompliance = new RequestProtocolCompliance(this.cacheConfig.isWeakETagOnPutDeleteAllowed());
    this.responseCachingPolicy = new ResponseCachingPolicy(
            this.cacheConfig.getMaxObjectSize(), this.cacheConfig.isSharedCache(),
            this.cacheConfig.isNeverCacheHTTP10ResponsesWithQuery(), this.cacheConfig.is303CachingEnabled());
    this.asynchRevalidator = asynchRevalidator;
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:24,代码来源:CachingExec.java


示例4: createCachingExecChain

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
@Override
public CachingExec createCachingExecChain(final ClientExecChain mockBackend,
        final HttpCache mockCache, final CacheValidityPolicy mockValidityPolicy,
        final ResponseCachingPolicy mockResponsePolicy,
        final CachedHttpResponseGenerator mockResponseGenerator,
        final CacheableRequestPolicy mockRequestPolicy,
        final CachedResponseSuitabilityChecker mockSuitabilityChecker,
        final ConditionalRequestBuilder mockConditionalRequestBuilder,
        final ResponseProtocolCompliance mockResponseProtocolCompliance,
        final RequestProtocolCompliance mockRequestProtocolCompliance,
        final CacheConfig config, final AsynchronousValidator asyncValidator) {
    return impl = new CachingExec(
            mockBackend,
            mockCache,
            mockValidityPolicy,
            mockResponsePolicy,
            mockResponseGenerator,
            mockRequestPolicy,
            mockSuitabilityChecker,
            mockConditionalRequestBuilder,
            mockResponseProtocolCompliance,
            mockRequestProtocolCompliance,
            config,
            asyncValidator);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:26,代码来源:TestCachingExec.java


示例5: setUp

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
@Before
public void setUp() {
    host = new HttpHost("foo.example.com", 80);

    route = new HttpRoute(host);

    body = HttpTestUtils.makeBody(entityLength);

    request = HttpRequestWrapper.wrap(new BasicHttpRequest("GET", "/foo", HttpVersion.HTTP_1_1));

    context = HttpCacheContext.create();
    context.setTargetHost(host);

    originResponse = Proxies.enhanceResponse(HttpTestUtils.make200Response());

    config = CacheConfig.custom()
        .setMaxCacheEntries(MAX_ENTRIES)
        .setMaxObjectSize(MAX_BYTES)
        .build();

    cache = new BasicHttpCache(config);
    mockBackend = EasyMock.createNiceMock(ClientExecChain.class);
    mockCache = EasyMock.createNiceMock(HttpCache.class);
    impl = createCachingExecChain(mockBackend, cache, config);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:26,代码来源:AbstractProtocolTest.java


示例6: emptyMockCacheExpectsNoPuts

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
protected void emptyMockCacheExpectsNoPuts() throws Exception {
    mockBackend = EasyMock.createNiceMock(ClientExecChain.class);
    mockCache = EasyMock.createNiceMock(HttpCache.class);

    impl = new CachingExec(mockBackend, mockCache, config);

    EasyMock.expect(mockCache.getCacheEntry(EasyMock.isA(HttpHost.class), EasyMock.isA(HttpRequest.class)))
        .andReturn(null).anyTimes();
    EasyMock.expect(mockCache.getVariantCacheEntriesWithEtags(EasyMock.isA(HttpHost.class), EasyMock.isA(HttpRequest.class)))
        .andReturn(new HashMap<String,Variant>()).anyTimes();

    mockCache.flushCacheEntriesFor(EasyMock.isA(HttpHost.class), EasyMock.isA(HttpRequest.class));
    EasyMock.expectLastCall().anyTimes();

    mockCache.flushCacheEntriesFor(EasyMock.isA(HttpHost.class), EasyMock.isA(HttpRequest.class));
    EasyMock.expectLastCall().anyTimes();

    mockCache.flushInvalidatedCacheEntriesFor(EasyMock.isA(HttpHost.class), EasyMock.isA(HttpRequest.class));
    EasyMock.expectLastCall().anyTimes();

    mockCache.flushInvalidatedCacheEntriesFor(EasyMock.isA(HttpHost.class), EasyMock.isA(HttpRequest.class), EasyMock.isA(HttpResponse.class));
    EasyMock.expectLastCall().anyTimes();
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:24,代码来源:AbstractProtocolTest.java


示例7: createMainExec

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
/**
 * Produces an instance of {@link ClientExecChain} to be used as a main exec.
 * <p>
 * Default implementation produces an instance of {@link MainClientExec}
 * </p>
 * <p>
 * For internal use.
 * </p>
 *
 * @since 4.4
 */
protected ClientExecChain createMainExec(
        final HttpRequestExecutor requestExec,
        final HttpClientConnectionManager connManager,
        final ConnectionReuseStrategy reuseStrategy,
        final ConnectionKeepAliveStrategy keepAliveStrategy,
        final HttpProcessor proxyHttpProcessor,
        final AuthenticationStrategy targetAuthStrategy,
        final AuthenticationStrategy proxyAuthStrategy,
        final UserTokenHandler userTokenHandler)
{
    return new MainClientExec(
            requestExec,
            connManager,
            reuseStrategy,
            keepAliveStrategy,
            proxyHttpProcessor,
            targetAuthStrategy,
            proxyAuthStrategy,
            userTokenHandler);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:32,代码来源:HttpClientBuilder.java


示例8: setup

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的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


示例9: TracingClientExec

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
public TracingClientExec(
    ClientExecChain clientExecChain,
    RedirectStrategy redirectStrategy,
    boolean redirectHandlingDisabled,
    Tracer tracer,
    List<ApacheClientSpanDecorator> spanDecorators) {
  this.requestExecutor = clientExecChain;
  this.redirectStrategy = redirectStrategy;
  this.redirectHandlingDisabled = redirectHandlingDisabled;
  this.tracer = tracer;
  this.spanDecorators = new ArrayList<>(spanDecorators);
}
 
开发者ID:opentracing-contrib,项目名称:java-apache-httpclient,代码行数:13,代码来源:TracingClientExec.java


示例10: decorateProtocolExec

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
@Override
protected ClientExecChain decorateProtocolExec(final ClientExecChain protocolExec) {
    final boolean myHttpClientSurroundCallsWithSubspan = surroundCallsWithSubspan;

    return new ClientExecChain() {
        @Override
        @SuppressWarnings("TryFinallyCanBeTryWithResources")
        public CloseableHttpResponse execute(HttpRoute route, HttpRequestWrapper request,
                                             HttpClientContext clientContext,
                                             HttpExecutionAware execAware) throws IOException, HttpException {

            Tracer tracer = Tracer.getInstance();
            Span spanAroundCall = null;
            if (myHttpClientSurroundCallsWithSubspan) {
                // Will start a new trace if necessary, or a subspan if a trace is already in progress.
                spanAroundCall = tracer.startSpanInCurrentContext(getSubspanSpanName(request), SpanPurpose.CLIENT);
            }

            try {
                propagateTracingHeaders(request, tracer.getCurrentSpan());
                return protocolExec.execute(route, request, clientContext, execAware);
            }
            finally {
                if (spanAroundCall != null) {
                    // Span.close() contains the logic we want - if the spanAroundCall was an overall span (new
                    //      trace) then tracer.completeRequestSpan() will be called, otherwise it's a subspan and
                    //      tracer.completeSubSpan() will be called.
                    spanAroundCall.close();
                }
            }
        }
    };
}
 
开发者ID:Nike-Inc,项目名称:wingtips,代码行数:34,代码来源:WingtipsHttpClientBuilder.java


示例11: decorateProtocolExec_works_as_expected

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
@DataProvider(value = {
    "true   |   true    |   true",
    "false  |   true    |   true",
    "true   |   false   |   true",
    "false  |   false   |   true",
    "true   |   true    |   false",
    "false  |   true    |   false",
    "true   |   false   |   false",
    "false  |   false   |   false"
}, splitBy = "\\|")
@Test
public void decorateProtocolExec_works_as_expected(
    boolean subspanOptionOn, boolean parentSpanExists, boolean throwExceptionInInnerChain
) throws IOException, HttpException {
    // given
    builder = WingtipsHttpClientBuilder.create(subspanOptionOn);
    RuntimeException exceptionToThrowInInnerChain = (throwExceptionInInnerChain)
                                                    ? new RuntimeException("kaboom")
                                                    : null;
    SpanCapturingClientExecChain origCec = spy(new SpanCapturingClientExecChain(exceptionToThrowInInnerChain));
    Span parentSpan = null;
    if (parentSpanExists) {
        parentSpan = Tracer.getInstance().startRequestWithRootSpan("someParentSpan");
    }

    // when
    ClientExecChain result = builder.decorateProtocolExec(origCec);

    // then
    verifyDecoratedClientExecChainPerformsTracingLogic(
        result, origCec, parentSpan, subspanOptionOn
    );
}
 
开发者ID:Nike-Inc,项目名称:wingtips,代码行数:34,代码来源:WingtipsHttpClientBuilderTest.java


示例12: setUp

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Before
public void setUp() {
    mockRequestPolicy = createNiceMock(CacheableRequestPolicy.class);
    mockValidityPolicy = createNiceMock(CacheValidityPolicy.class);
    mockBackend = createNiceMock(ClientExecChain.class);
    mockCache = createNiceMock(HttpCache.class);
    mockSuitabilityChecker = createNiceMock(CachedResponseSuitabilityChecker.class);
    mockResponsePolicy = createNiceMock(ResponseCachingPolicy.class);
    mockHandler = createNiceMock(ResponseHandler.class);
    mockUriRequest = createNiceMock(HttpUriRequest.class);
    mockCacheEntry = createNiceMock(HttpCacheEntry.class);
    mockResponseGenerator = createNiceMock(CachedHttpResponseGenerator.class);
    mockCachedResponse = createNiceMock(CloseableHttpResponse.class);
    mockConditionalRequestBuilder = createNiceMock(ConditionalRequestBuilder.class);
    mockConditionalRequest = createNiceMock(HttpRequest.class);
    mockStatusLine = createNiceMock(StatusLine.class);
    mockResponseProtocolCompliance = createNiceMock(ResponseProtocolCompliance.class);
    mockRequestProtocolCompliance = createNiceMock(RequestProtocolCompliance.class);
    mockStorage = createNiceMock(HttpCacheStorage.class);
    config = CacheConfig.DEFAULT;
    asyncValidator = new AsynchronousValidator(config);

    host = new HttpHost("foo.example.com", 80);
    route = new HttpRoute(host);
    request = HttpRequestWrapper.wrap(new BasicHttpRequest("GET", "/stuff",
        HttpVersion.HTTP_1_1));
    context = HttpCacheContext.create();
    context.setTargetHost(host);
    entry = HttpTestUtils.makeCacheEntry();
    impl = createCachingExecChain(mockBackend, mockCache, mockValidityPolicy,
        mockResponsePolicy, mockResponseGenerator, mockRequestPolicy, mockSuitabilityChecker,
        mockConditionalRequestBuilder, mockResponseProtocolCompliance,
        mockRequestProtocolCompliance, config, asyncValidator);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:36,代码来源:TestCachingExecChain.java


示例13: createCachingExecChain

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
public abstract ClientExecChain createCachingExecChain(ClientExecChain backend,
HttpCache responseCache, CacheValidityPolicy validityPolicy,
ResponseCachingPolicy responseCachingPolicy, CachedHttpResponseGenerator responseGenerator,
CacheableRequestPolicy cacheableRequestPolicy,
CachedResponseSuitabilityChecker suitabilityChecker,
ConditionalRequestBuilder conditionalRequestBuilder,
ResponseProtocolCompliance responseCompliance, RequestProtocolCompliance requestCompliance,
CacheConfig config, AsynchronousValidator asynchRevalidator);
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:9,代码来源:TestCachingExecChain.java


示例14: setUp

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
@Override
@Before
public void setUp() {
    super.setUp();
    config = CacheConfig.custom().setMaxObjectSize(MAX_BYTES).build();

    if (CACHE_MANAGER.cacheExists(TEST_EHCACHE_NAME)){
        CACHE_MANAGER.removeCache(TEST_EHCACHE_NAME);
    }
    CACHE_MANAGER.addCache(TEST_EHCACHE_NAME);
    final HttpCacheStorage storage = new EhcacheHttpCacheStorage(CACHE_MANAGER.getCache(TEST_EHCACHE_NAME));
    mockBackend = EasyMock.createNiceMock(ClientExecChain.class);

    impl = new CachingExec(mockBackend, new HeapResourceFactory(), storage, config);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:16,代码来源:TestEhcacheProtocolRequirements.java


示例15: createAsynchronousValidationRequest

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
private AsynchronousValidationRequest createAsynchronousValidationRequest(final int errorCount) {
    final ClientExecChain clientExecChain = mock(ClientExecChain.class);
    final CachingExec cachingHttpClient = new CachingExec(clientExecChain);
    final AsynchronousValidator mockValidator = new AsynchronousValidator(impl);
    final HttpRoute httpRoute = new HttpRoute(new HttpHost("foo.example.com", 80));
    final HttpRequestWrapper httpRequestWrapper = HttpRequestWrapper.wrap(new BasicHttpRequest("GET", "/"));
    final HttpClientContext httpClientContext = new HttpClientContext();
    return new AsynchronousValidationRequest(mockValidator, cachingHttpClient, httpRoute, httpRequestWrapper,
            httpClientContext, null, null, "identifier", errorCount);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:11,代码来源:TestExponentialBackingOffSchedulingStrategy.java


示例16: setUp

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
@Before
public void setUp() {
    host = new HttpHost("foo.example.com", 80);

    route = new HttpRoute(host);

    body = makeBody(entityLength);

    request = new BasicHttpRequest("GET", "/foo", HTTP_1_1);

    context = HttpCacheContext.create();
    context.setTargetHost(host);

    originResponse = Proxies.enhanceResponse(make200Response());

    final CacheConfig config = CacheConfig.custom()
            .setMaxCacheEntries(MAX_ENTRIES)
            .setMaxObjectSize(MAX_BYTES)
            .build();

    final HttpCache cache = new BasicHttpCache(config);
    mockBackend = EasyMock.createNiceMock(ClientExecChain.class);
    mockEntity = EasyMock.createNiceMock(HttpEntity.class);
    mockCache = EasyMock.createNiceMock(HttpCache.class);

    impl = createCachingExecChain(mockBackend, cache, config);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:28,代码来源:TestProtocolDeviations.java


示例17: decorateProtocolExec

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
@Override
protected ClientExecChain decorateProtocolExec(final ClientExecChain requestExecutor) {
    return new TracingClientExec(requestExecutor, redirectStrategy,
            redirectHandlingDisabled, tracer, spanDecorators);
}
 
开发者ID:opentracing-contrib,项目名称:java-apache-httpclient,代码行数:6,代码来源:TracingHttpClientBuilder.java


示例18: ProxyFeedBackClientExecChain

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
public ProxyFeedBackClientExecChain(ClientExecChain delegate) {
    this.delegate = delegate;
}
 
开发者ID:virjar,项目名称:vscrawler,代码行数:4,代码来源:ProxyFeedBackClientExecChain.java


示例19: decorateProtocolExec

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
@Override
protected ClientExecChain decorateProtocolExec(ClientExecChain protocolExec) {
    return new ProxyFeedBackClientExecChain(protocolExec);
}
 
开发者ID:virjar,项目名称:vscrawler,代码行数:5,代码来源:ProxyFeedBackDecorateHttpClientBuilder.java


示例20: decorateMainExec

import org.apache.http.impl.execchain.ClientExecChain; //导入依赖的package包/类
/**
 * For internal use.
 */
protected ClientExecChain decorateMainExec(final ClientExecChain mainExec) {
    return mainExec;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:7,代码来源:HttpClientBuilder.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Configuration类代码示例发布时间:2022-05-23
下一篇:
Java WMSCapabilities类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap