hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Moore <j...@apache.org>
Subject Re: RFC5861 not working
Date Thu, 03 Nov 2011 01:38:10 GMT
Hi Thomas,

You are probably looking for the stale-while-revalidate directive to
be sent by the server to get asynchronous validation; stale-if-error
just allows the cache to serve a stale data if it receives, e.g., a
503 response on the (synchronous) validation request.

Jon

On Wed, Nov 2, 2011 at 7:58 PM, Thomas Van de Velde
<thomasevdv@gmail.com> wrote:
> Hi,
>
> I am trying to make RFC5861-style background validation work in my client
> and it does not seem to work. Did I miss something in the client code or
> server headers (see below)?
>
> Thanks!
>
> Thomas
>
>
> ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager();
> cm.setMaxTotal(1000);
> cm.setDefaultMaxPerRoute(100);
> HttpClient httpClient = new DefaultHttpClient(cm);
> CacheConfig cacheConfig = new CacheConfig();
> cacheConfig.setMaxObjectSizeBytes(1000000);
> cacheConfig.setRevalidationQueueSize(1000);
> cacheConfig.setAsynchronousWorkersCore(100);
> cacheConfig.setAsynchronousWorkersMax(1000);
> cacheConfig.setAsynchronousWorkerIdleLifetimeSecs(100);
> cacheConfig.setSharedCache(true);
> cachingClient = new CachingHttpClient(httpClient,
> new EhcacheHttpCacheStorage(httpCache),
> cacheConfig);
>
> HttpGet httpget = new HttpGet(uri);
>
> try {
> HttpResponse response = cachingClient
> .execute(httpget, localContext);
> HttpEntity entity = response.getEntity();
> entity.getContent();
>
> EntityUtils.consume(entity);
>
> } catch (Exception e) {
> httpget.abort();
> }
>
>
>
> DEBUG: org.apache.http.wire - >> "GET /repository/details HTTP/1.1[\r][\n]"
> DEBUG: org.apache.http.wire - >> "Via: 1.1 localhost
> (Apache-HttpClient/4.1.2 (cache))[\r][\n]"
> DEBUG: org.apache.http.wire - >> "If-None-Match:
> "3-bc1a9339e9de45baefb04f8a66013365"[\r][\n]"
> DEBUG: org.apache.http.wire - >> "Host: localhost[\r][\n]"
> DEBUG: org.apache.http.wire - >> "Connection: Keep-Alive[\r][\n]"
> DEBUG: org.apache.http.wire - >> "User-Agent: Apache-HttpClient/4.1.2 (java
> 1.5)[\r][\n]"
> DEBUG: org.apache.http.wire - >> "[\r][\n]"
> DEBUG: org.apache.http.wire - << "HTTP/1.1 304 Not Modified[\r][\n]"
> DEBUG: org.apache.http.wire - << "Date: Wed, 02 Nov 2011 23:53:15
> GMT[\r][\n]"
> DEBUG: org.apache.http.wire - << "Connection: Keep-Alive[\r][\n]"
> DEBUG: org.apache.http.wire - << "Keep-Alive: timeout=5, max=79[\r][\n]"
> DEBUG: org.apache.http.wire - << "Etag:
> "3-bc1a9339e9de45baefb04f8a66013365"[\r][\n]"
> DEBUG: org.apache.http.wire - << "Cache-Control: public,
> stale-if-error=43200[\r][\n]"
> DEBUG: org.apache.http.wire - << "[\r][\n]"
>

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message