users@jersey.java.net

Re: [Jersey] Looking for "best practices"

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 19 Jan 2010 13:32:23 +0000

On Jan 19, 2010, at 1:20 PM, Felipe Gaścho wrote:

> after you sending the chart for the very first time to the client,
> just include an ETAG or Expire headers to set cache to 1 month ....
>
> so, a same client will only select a new chart in one month :)
>
> * if the chart generation is dynamic, than you are right, you can
> cache the generated charts in the server side, mapped to the HTTP
> requests (I guess)...
>
> But you should use the server cache carefully.. to avoid the trap of
> adopting a comfortable solution of caching things that should be
> cached on the client side........
>

Again, it depends on the application, and caching can happen on web
proxies, can happen on servers, can happen on clients.

Casper, from what you describe i think you are generally doing the
right approach but may want to review (if not already) the use of the
Cache-Control header to ensure proxies and clients handle the
representations properly.

The Cache-Control header can define how web-proxies and clients can
cache resources according to HTTP caching semantics. But a word of
warning the cacheing semantics of HTTP are probably the most difficult
aspect of HTTP to understand, which is why using a caching proxy
server close to the edge/clients might be a good approach.

Mark Nottingham has written some excellent documents on HTTP caching.

Paul.