Java 类org.apache.http.impl.client.cache.BasicHttpCacheStorage 实例源码

项目:csvsum    文件:JSONUtil.java   
public static HttpClientBuilder getHttpClientBuilder() {
    // Common CacheConfig for both the JarCacheStorage and the underlying
    // BasicHttpCacheStorage
    final CacheConfig cacheConfig = CacheConfig.custom().setMaxCacheEntries(1000).setMaxObjectSize(1024 * 128)
            .build();

    RequestConfig config = RequestConfig.custom().setConnectTimeout(DEFAULT_TIMEOUT)
            .setConnectionRequestTimeout(DEFAULT_TIMEOUT).setSocketTimeout(DEFAULT_TIMEOUT).build();

    HttpClientBuilder clientBuilder = CachingHttpClientBuilder.create()
            // allow caching
            .setCacheConfig(cacheConfig)
            // Wrap the local JarCacheStorage around a BasicHttpCacheStorage
            .setHttpCacheStorage(new JarCacheStorage(null, cacheConfig, new BasicHttpCacheStorage(cacheConfig)))
            // Support compressed data
            // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/httpagent.html#d5e1238
            .addInterceptorFirst(new RequestAcceptEncoding()).addInterceptorFirst(new ResponseContentEncoding())
            // use system defaults for proxy etc.
            .useSystemProperties().setDefaultRequestConfig(config);
    return clientBuilder;
}
项目:jira-dvcs-connector    文件:HttpClientProvider.java   
private HttpCacheStorage createStorage()
{
    CacheConfig config = new CacheConfig();
    // if max cache entries value is not present the CacheConfig's default (CacheConfig.DEFAULT_MAX_CACHE_ENTRIES = 1000) will be used
    Integer maxCacheEntries = Integer.getInteger("bitbucket.client.cache.maxentries");
    if (maxCacheEntries != null)
    {
        config.setMaxCacheEntries(maxCacheEntries);
    }
    return new BasicHttpCacheStorage(config);
}
项目:jira-dvcs-connector    文件:EtagCachingHttpClient.java   
public EtagCachingHttpClient()
{
    this(new DefaultHttpClient(), new BasicHttpCacheStorage(new CacheConfig()));
}
项目:jira-dvcs-connector    文件:EtagCachingHttpClient.java   
public EtagCachingHttpClient(HttpClient httpClient)
{
    this(httpClient, new BasicHttpCacheStorage(new CacheConfig()));
}