JSONUtil.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:csvsum 作者:
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;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号