Cache static resources like css, js and images for a specific time period

Sometimes we need to cache some static resources so that performance of the site can be improved over the time.

Static resources like css, js images etc. need not be reloaded from the server every time until and unless we want the old one needs to be replaced by the new one.

So here I am going to give an example how caching mechanism works in java based web application.

Create some Enums first



Now create filters


 Now put entries in web.xml file

That’s all. Thanks for your patience. Please leave a comment.


Software Professional, I am passionate to work on web/enterprise application. For more information please go to about me. You can follow on Twitter. You can be a friend on Facebook or Google Plus or Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.