Example usage for org.apache.http.impl.client.cache CacheValidityPolicy CacheValidityPolicy

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

Introduction

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

Prototype

CacheValidityPolicy() 

Source Link

Usage

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

CachedResponseSuitabilityChecker(CacheConfig config) {
    this(new CacheValidityPolicy(), config);
}

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

public CachingExec(final ClientExecChain backend, final HttpCache cache, final CacheConfig config,
        final AsynchronousValidator asynchRevalidator) {
    super();/*from  w w  w.  j  av  a2  s  .co m*/
    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, config);
    this.conditionalRequestBuilder = new ConditionalRequestBuilder();
    this.responseCompliance = new ResponseProtocolCompliance();
    this.requestCompliance = new RequestProtocolCompliance(config.isWeakETagOnPutDeleteAllowed());
    this.responseCachingPolicy = new ResponseCachingPolicy(this.cacheConfig.getMaxObjectSize(),
            this.cacheConfig.isSharedCache(), this.cacheConfig.isNeverCacheHTTP10ResponsesWithQuery(),
            this.cacheConfig.is303CachingEnabled());
    this.asynchRevalidator = asynchRevalidator;
}

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

CachingHttpAsyncClient(final HttpAsyncClient client, final HttpCache cache, final CacheConfig config) {
    super();//w w  w  .j a  v a  2s.  c om
    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.CachingHttpClient.java

CachingHttpClient(HttpClient client, HttpCache cache, CacheConfig config) {
    super();/*from   w  w  w.j  a 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);
}