Package org.apache.http.impl.client.cache

Examples of org.apache.http.impl.client.cache.CacheConfig


        final HttpCacheEntry updatedValue = HttpTestUtils.makeCacheEntry();
        final byte[] oldBytes = HttpTestUtils.getRandomBytes(128);
        final CASValue<Object> casValue = new CASValue<Object>(1, oldBytes);
        final byte[] newBytes = HttpTestUtils.getRandomBytes(128);

        final CacheConfig config = CacheConfig.custom().setMaxUpdateRetries(0).build();
        impl = new MemcachedHttpCacheStorage(mockMemcachedClient, config,
                mockMemcachedCacheEntryFactory, mockKeyHashingScheme);

        final HttpCacheUpdateCallback callback = new HttpCacheUpdateCallback() {
            @Override
View Full Code Here


                final DefaultHttpClient client = new SystemDefaultHttpClient();
                // Support compressed data
                // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/httpagent.html#d5e1238
                client.addRequestInterceptor(new RequestAcceptEncoding());
                client.addResponseInterceptor(new ResponseContentEncoding());
                final CacheConfig cacheConfig = new CacheConfig();
                cacheConfig.setMaxObjectSize(1024 * 128); // 128 kB
                cacheConfig.setMaxCacheEntries(1000);
                // and allow caching
                final CachingHttpClient cachingClient = new CachingHttpClient(client, cacheConfig);

                // Wrap again with JAR cache
                final JarCacheStorage jarCache = new JarCacheStorage();
View Full Code Here

      int socketTimeout = readFromProperty("bdSocketTimeout", globalTimeout);
      RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT).setConnectTimeout(connectTimeout)
        .setSocketTimeout(socketTimeout).setConnectionRequestTimeout(connectionRequestTimeout).build();

      // configure caching
      CacheConfig cacheConfig = CacheConfig.copy(CacheConfig.DEFAULT).setSharedCache(false).setMaxCacheEntries(1000)
        .setMaxObjectSize(2 * 1024 * 1024).build();

      // configure connection pooling
      PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager();
      int connectionLimit = readFromProperty("bdMaxConnections", 40);
View Full Code Here

      // set timeouts for the HTTP client
      RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT).setConnectTimeout(10000)
        .setSocketTimeout(10000).setConnectionRequestTimeout(10000).build();

      // configure caching
      CacheConfig cacheConfig = CacheConfig.copy(CacheConfig.DEFAULT).setSharedCache(false).setMaxCacheEntries(1000)
        .setMaxObjectSize(2 * 1024 * 1024).build();

      // create the HTTP client
      return CachingHttpClientBuilder.create().setCacheConfig(cacheConfig).setSslcontext(sslContext)
        .setDefaultRequestConfig(requestConfig).build();
View Full Code Here

      int socketTimeout = readFromProperty("bdSocketTimeout", globalTimeout);
      RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT).setConnectTimeout(connectTimeout)
        .setSocketTimeout(socketTimeout).setConnectionRequestTimeout(connectionRequestTimeout).build();

      // configure caching
      CacheConfig cacheConfig = CacheConfig.copy(CacheConfig.DEFAULT).setSharedCache(false).setMaxCacheEntries(1000)
        .setMaxObjectSize(2 * 1024 * 1024).build();

      // configure connection pooling
      PoolingHttpClientConnectionManager connManager = new PoolingHttpClientConnectionManager(RegistryBuilder
        .<ConnectionSocketFactory> create().register("http", PlainConnectionSocketFactory.getSocketFactory())
View Full Code Here

                    final DefaultHttpClient client = new SystemDefaultHttpClient();
                    // Support compressed data
                    // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/httpagent.html#d5e1238
                    client.addRequestInterceptor(new RequestAcceptEncoding());
                    client.addResponseInterceptor(new ResponseContentEncoding());
                    final CacheConfig cacheConfig = new CacheConfig();
                    cacheConfig.setMaxObjectSize(1024 * 128); // 128 kB
                    cacheConfig.setMaxCacheEntries(1000);
                    // and allow caching
                    httpClient = new CachingHttpClient(client, cacheConfig);
                }
            }
        }
View Full Code Here

                    final DefaultHttpClient client = new SystemDefaultHttpClient();
                    // Support compressed data
                    // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/httpagent.html#d5e1238
                    client.addRequestInterceptor(new RequestAcceptEncoding());
                    client.addResponseInterceptor(new ResponseContentEncoding());
                    final CacheConfig cacheConfig = new CacheConfig();
                    cacheConfig.setMaxObjectSize(1024 * 128); // 128 kB
                    cacheConfig.setMaxCacheEntries(1000);
                    // and allow caching
                    httpClient = new CachingHttpClient(client, cacheConfig);
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.http.impl.client.cache.CacheConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.