Example usage for org.apache.http.impl.client.cache CacheConfig isSharedCache

List of usage examples for org.apache.http.impl.client.cache CacheConfig isSharedCache

Introduction

In this page you can find the example usage for org.apache.http.impl.client.cache CacheConfig isSharedCache.

Prototype

boolean isSharedCache

To view the source code for org.apache.http.impl.client.cache CacheConfig isSharedCache.

Click Source Link

Usage

From source file:org.apache.http.impl.client.cache.CachedResponseSuitabilityChecker.java

CachedResponseSuitabilityChecker(final CacheValidityPolicy validityStrategy, CacheConfig config) {
    super();/*from  w  ww . j a  v a 2 s . c o  m*/
    this.validityStrategy = validityStrategy;
    this.sharedCache = config.isSharedCache();
    this.useHeuristicCaching = config.isHeuristicCachingEnabled();
    this.heuristicCoefficient = config.getHeuristicCoefficient();
    this.heuristicDefaultLifetime = config.getHeuristicDefaultLifetime();
}

From source file:org.apache.http.impl.client.cache.CachingHttpAsyncClient.java

CachingHttpAsyncClient(final HttpAsyncClient client, final HttpCache cache, final CacheConfig config) {
    super();//from  w ww  .java 2s .  c  o m
    Args.notNull(client, "HttpClient");
    Args.notNull(cache, "HttpCache");
    Args.notNull(config, "CacheConfig");
    this.maxObjectSizeBytes = config.getMaxObjectSize();
    this.sharedCache = config.isSharedCache();
    this.backend = client;
    this.responseCache = cache;
    this.validityPolicy = new CacheValidityPolicy();
    this.responseCachingPolicy = new ResponseCachingPolicy(this.maxObjectSizeBytes, this.sharedCache, false,
            config.is303CachingEnabled());
    this.responseGenerator = new CachedHttpResponseGenerator(this.validityPolicy);
    this.cacheableRequestPolicy = new CacheableRequestPolicy();
    this.suitabilityChecker = new CachedResponseSuitabilityChecker(this.validityPolicy, config);
    this.conditionalRequestBuilder = new ConditionalRequestBuilder();

    this.responseCompliance = new ResponseProtocolCompliance();
    this.requestCompliance = new RequestProtocolCompliance(config.isWeakETagOnPutDeleteAllowed());

    this.asynchAsyncRevalidator = makeAsynchronousValidator(config);
}

From source file:org.apache.http.impl.client.cache.CachingHttpAsyncClient.java

CachingHttpAsyncClient(final HttpAsyncClient backend, final CacheValidityPolicy validityPolicy,
        final ResponseCachingPolicy responseCachingPolicy, final HttpCache responseCache,
        final CachedHttpResponseGenerator responseGenerator,
        final CacheableRequestPolicy cacheableRequestPolicy,
        final CachedResponseSuitabilityChecker suitabilityChecker,
        final ConditionalRequestBuilder conditionalRequestBuilder,
        final ResponseProtocolCompliance responseCompliance,
        final RequestProtocolCompliance requestCompliance) {
    final CacheConfig config = CacheConfig.DEFAULT;
    this.maxObjectSizeBytes = config.getMaxObjectSize();
    this.sharedCache = config.isSharedCache();
    this.backend = backend;
    this.validityPolicy = validityPolicy;
    this.responseCachingPolicy = responseCachingPolicy;
    this.responseCache = responseCache;
    this.responseGenerator = responseGenerator;
    this.cacheableRequestPolicy = cacheableRequestPolicy;
    this.suitabilityChecker = suitabilityChecker;
    this.conditionalRequestBuilder = conditionalRequestBuilder;
    this.responseCompliance = responseCompliance;
    this.requestCompliance = requestCompliance;
    this.asynchAsyncRevalidator = makeAsynchronousValidator(config);
}

From source file:org.apache.http.impl.client.cache.CachingHttpClient.java

CachingHttpClient(HttpClient client, HttpCache cache, CacheConfig config) {
    super();//w w w.  ja  v  a  2  s  .c o  m
    if (client == null) {
        throw new IllegalArgumentException("HttpClient may not be null");
    }
    if (cache == null) {
        throw new IllegalArgumentException("HttpCache may not be null");
    }
    if (config == null) {
        throw new IllegalArgumentException("CacheConfig may not be null");
    }
    this.maxObjectSizeBytes = config.getMaxObjectSizeBytes();
    this.sharedCache = config.isSharedCache();
    this.backend = client;
    this.responseCache = cache;
    this.validityPolicy = new CacheValidityPolicy();
    this.responseCachingPolicy = new ResponseCachingPolicy(maxObjectSizeBytes, sharedCache);
    this.responseGenerator = new CachedHttpResponseGenerator(this.validityPolicy);
    this.cacheableRequestPolicy = new CacheableRequestPolicy();
    this.suitabilityChecker = new CachedResponseSuitabilityChecker(this.validityPolicy, config);
    this.conditionalRequestBuilder = new ConditionalRequestBuilder();

    this.responseCompliance = new ResponseProtocolCompliance();
    this.requestCompliance = new RequestProtocolCompliance();

    this.asynchRevalidator = makeAsynchronousValidator(config);
}

From source file:org.apache.http.impl.client.cache.CachingHttpClient.java

CachingHttpClient(HttpClient backend, CacheValidityPolicy validityPolicy,
        ResponseCachingPolicy responseCachingPolicy, HttpCache responseCache,
        CachedHttpResponseGenerator responseGenerator, CacheableRequestPolicy cacheableRequestPolicy,
        CachedResponseSuitabilityChecker suitabilityChecker,
        ConditionalRequestBuilder conditionalRequestBuilder, ResponseProtocolCompliance responseCompliance,
        RequestProtocolCompliance requestCompliance) {
    CacheConfig config = new CacheConfig();
    this.maxObjectSizeBytes = config.getMaxObjectSizeBytes();
    this.sharedCache = config.isSharedCache();
    this.backend = backend;
    this.validityPolicy = validityPolicy;
    this.responseCachingPolicy = responseCachingPolicy;
    this.responseCache = responseCache;
    this.responseGenerator = responseGenerator;
    this.cacheableRequestPolicy = cacheableRequestPolicy;
    this.suitabilityChecker = suitabilityChecker;
    this.conditionalRequestBuilder = conditionalRequestBuilder;
    this.responseCompliance = responseCompliance;
    this.requestCompliance = requestCompliance;
    this.asynchRevalidator = makeAsynchronousValidator(config);
}