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

Examples of org.apache.http.impl.client.cache.CachingHttpClient$AsynchronousValidator


                    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);
                }
            }
        }
        return httpClient;
    }
View Full Code Here


        final URL url = new URL("http://json-ld.org/contexts/person.jsonld");
        DocumentLoader.fromURL(url);

        // Now try to get it again and ensure it is
        // cached
        final HttpClient client = new CachingHttpClient(DocumentLoader.getHttpClient());
        final HttpUriRequest get = new HttpGet(url.toURI());
        get.setHeader("Accept", DocumentLoader.ACCEPT_HEADER);
        final HttpContext localContext = new BasicHttpContext();
        final HttpResponse respo = client.execute(get, localContext);
        EntityUtils.consume(respo.getEntity());

        // Check cache status
        // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/caching.html
        final CacheResponseStatus responseStatus = (CacheResponseStatus) localContext
View Full Code Here

                    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);
                }
            }
        }
        return httpClient;
    }
View Full Code Here

TOP

Related Classes of org.apache.http.impl.client.cache.CachingHttpClient$AsynchronousValidator

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.