Two Servlet Filters Every Web Application Should Have
Subject:   Also enable caching at the browser level
Date:   2003-11-24 12:29:37
From:   jfalkner
Response to: Also enable caching at the browser level

Good point. Here is a little bit of text and filter code for manipulating the Cache-Control HTTP header. The writeup also includes a link to the HTTP 1.1 spec section describing the Cache-Control filter.

I don't think mixing code for client-side cache control and server-side caching is a good idea. Mostly because the logic gets a little messy, e.g. usually you don't want to server-side cache static resources such as images, but you almost always would want to try and have the client cache images. How do you go about deploying the same filter to do this well? Might as well split the functionality in to two simple filters.