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

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

Introduction

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

Prototype

public int getMaxObjectSizeBytes() 

Source Link

Document

Returns the current maximum response body size that will be cached.

Usage

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

public BasicHttpCache(ResourceFactory resourceFactory, HttpCacheStorage storage, CacheConfig config) {
    this.resourceFactory = resourceFactory;
    this.uriExtractor = new CacheKeyGenerator();
    this.cacheEntryUpdater = new CacheEntryUpdater(resourceFactory);
    this.maxObjectSizeBytes = config.getMaxObjectSizeBytes();
    this.responseGenerator = new CachedHttpResponseGenerator();
    this.storage = storage;
    this.cacheInvalidator = new CacheInvalidator(this.uriExtractor, this.storage);
}

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

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