Article:
 |
|
Two Servlet Filters Every Web Application Should Have
|
| Subject: |
|
Also enable caching at the browser level |
| Date: |
|
2003-11-24 02:08:08 |
| From: |
|
anonymous2
|
|
|
|
Make sure also to investigate caching at the browser level. It can really make an enormous difference to the user experience.
We use a servlet filter to add a
Cache-Control: public, max-age=3600
http header to all recurring static content (e.g. gifs, jpgs, style sheets, javascript etc).
In our case, this removed approx 75% of all hits to the server - and made the pages load much faster.
You may want to extend the filter to also handle the if-modified-since request header.
|
Showing messages 1 through 1 of 1.
-
Also enable caching at the browser level
2003-11-24 12:29:37
jfalkner
[Reply | View]
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.