Enable Caching in Tomcat

Caching helps when you do not want some particular files to be download each time. Sometimes you may required to put extra header so that cached content get expires it self after sometime. 

So here is a post, how you can implement a Caching mechanism on Tomcat.

1. First You will have to download "Cache Filter" jar file from the below location.
http://code.google.com/p/cache-filter/downloads/list

2. Once you are done with download, put that jar file in tomcat/webapps/ROOT/WEB-INF/lib location.

3. Now open tomcat/webapps/ROOT/WEB-INF/web.xml file and add filter and filter-mapping properties as mentioned below.
4. Once you done with changes, you can restart Tomcat and check the expires header through firebug.

Hope this helps!!!

No comments:

Post a Comment