Caching helps when you want to leverage files not being downloaded each time and serve it from cache. Browser headers needs to have such information so that cached content get expires it self after sometime.
Below are steps to implement Caching on Tomcat server
1. You will have to download “Cache Filter” jar file from the below location.
2. Put that jar file in tomcat/webapps/ROOT/WEB-INF/lib location.
3. Edit tomcat/webapps/ROOT/WEB-INF/web.xml file and add filter and filter-mapping properties as mentioned below.
4. Restart Tomcat and check the expires headers on browsers.