|
From: Weinan Li <we...@re...> - 2014-04-30 13:35:10
|
my email get rejected by mailing list so I have to remove the attachments. sorry for that.
--
Weinan Li / JBoss
On Wednesday, April 30, 2014 at 8:49 PM, Weinan Li wrote:
> Hi Mark,
>
> I’ve done some testings on resteasy client side caching feature, and it works without any problems. Maybe you’d like to check these test cases as code examples:
>
> - jaxrs/resteasy-jaxrs/src/test/java/org/jboss/resteasy/test/client/cache/ClientCacheTest.java
> - jaxrs/resteasy-jaxrs-testsuite/src/test/java/org/jboss/resteasy/test/nextgen/client/cache/ClientCacheTest.java
>
> According to your questions on ClientRequestFilter, I do see the local cache is used:
>
> protected BrowserCache cache;
> public CacheInterceptor(BrowserCache cache)
> {
> this.cache = cache;
> }
>
>
>
> And the etag is always checked:
>
> BrowserCache.Entry entry = getEntry(request);
> if (entry == null) return;
> if (entry.expired())
>
>
> …
>
> As you can see above, in filter method the local cache is checked. Please note the BrowserCache is the local caching store, and LightweightBrowserCache is the default implementation.
>
> I’ve attached some uml diagrams fyi, wish it's useful to you :-)
> --
> Weinan Li / JBoss
>
>
> On Monday, April 28, 2014 at 3:05 PM, Weinan Li wrote:
>
> > Hi Mark,
> >
> > I’ll look into this and let you know my progress.
> >
> >
> > Weinan Li / JBoss
> >
> > > On Apr 18, 2014, at 6:09 AM, Mark Petrovic <msp...@gm... (mailto:msp...@gm...)> wrote:
> > >
> > > I'm sorry I do not. I studied the code line by line and the question
> > > occurred to me.
> > >
> > > On Thu, Apr 17, 2014 at 2:17 PM, Bill Burke <bb...@re... (mailto:bb...@re...)> wrote:
> > >
> > > > You got a test that reproduces this?
> > > >
> > > > On 4/15/2014 12:43 PM, Mark Petrovic wrote:
> > > >
> > > > > Good day.
> > > > >
> > > > > I am studying HTTP caching, and I have been helped a great deal by
> > > > > a close reading of the Resteasy CacheInterceptor client filter
> > > > > example:
> > > > >
> > > > > https://github.com/resteasy/Resteasy/blob/master/jaxrs/resteasy-client/src/main/java/org/jboss/resteasy/client/jaxrs/cache/CacheInterceptor.java
> > > > >
> > > > > I am still learning and could easily be missing something. But it
> > > > > seems to me that if
> > > > >
> > > > > 1) the client sets an If-None-Match header with an Etag value
> > > > >
> > > > > and
> > > > >
> > > > > 2) there is no local cache entry whatsoever, expired or not, as
> > > > > determined in the ClientRequestFilter implementation
> > > > >
> > > > > and
> > > > >
> > > > > 3) the server returns 304 by virtue of the If-None-Match header
> > > > >
> > > > > then the ClientResponseFilter implementation will try to fetch a
> > > > > response from cache when it is already determined that there is no
> > > > > such entry. Consequently, the client is left with no usable response
> > > > > available from cache or from the origin server.
> > > > >
> > > > > If I am correct, then if there is no cache entry as determined in
> > > > > the ClientRequestFilter implementation, is it appropriate to remove
> > > > > any If-None-Match -type headers before the request is sent?
> > > > >
> > > > > Thank you for your time as I try to understand this.
> > > >
> > > >
> > > > --
> > > > Bill Burke
> > > > JBoss, a division of Red Hat
> > > > http://bill.burkecentral.com
> > > >
> > > > ------------------------------------------------------------------------------
> > > > Learn Graph Databases - Download FREE O'Reilly Book
> > > > "Graph Databases" is the definitive new guide to graph databases and their
> > > > applications. Written by three acclaimed leaders in the field,
> > > > this first edition is now available. Download your free book today!
> > > > http://p.sf.net/sfu/NeoTech
> > > > _______________________________________________
> > > > Resteasy-developers mailing list
> > > > Res...@li... (mailto:Res...@li...)
> > > > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
> > >
> > >
> > >
> > >
> > >
> > >
> > > --
> > > Mark
> > >
> > > ------------------------------------------------------------------------------
> > > Learn Graph Databases - Download FREE O'Reilly Book
> > > "Graph Databases" is the definitive new guide to graph databases and their
> > > applications. Written by three acclaimed leaders in the field,
> > > this first edition is now available. Download your free book today!
> > > http://p.sf.net/sfu/NeoTech
> > > _______________________________________________
> > > Resteasy-developers mailing list
> > > Res...@li... (mailto:Res...@li...)
> > > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
> >
>
>
>
> Attachments:
> - org.jboss.resteasy.client.jaxrs.cache.jpg
>
> - org.jboss.resteasy.client.jaxrs.cache.CacheInterceptor.filter(ClientRequestContext).jpg
>
> - org.jboss.resteasy.client.jaxrs.cache.CacheInterceptor.getEntry(ClientRequestContext).jpg
>
|