Enabling Cache Filter on Tomcat in Jasper 7.X

Posted on by By admin, in Jaspersoft | 0

Environment details
Jasperserver Pro – 7.1.0
Apache Tomcat – 8.5.30

The purpose of enabling cache filter on tomcat is to cache static files such as images/CSS/javascript files, HTML files. This decreases the load on the tomcat server because the browser will first check the cache before requesting another static file.

To achieve the same in Jaspersoft 7.1.0, please follow the steps below –

  1. Take the back up of applicationContext-webapp.xml from location
  2. (Jasper Home)/WEB-INF/

  3. Copy the provided applicationContext-webapp.xml to the location –
  4. (Jasper Home)/WEB-INF/

  5. Clear work and Temp directory
  6. Restart the tomcat server.

Modification is done in applicationContext-webapp.xml –

Changed maxAge value for bean staticResourcesExpiresHeader from 365 days to 5 minutes.

Here values are given in seconds.

<bean id="staticResourcesExpiresHeader" p:maxAge="300" class="com.jaspersoft.jasperserver.war.httpheaders.JRSExpiresHeader" />

Test Case implemented::

  1. when executing jasper login URL in the browser for the first time-
  2. executing jasper login URL

  3. Jasper UI loaded the second time –
  4. Jasper UI

  5. When there is any change in the static files –
    1. For this, we had made below change in js.config.properties file present inside (Jasper Home)/WEB-INF/
    2. javascript.optimize = false

    3. Restarted the tomcat server
    4. Loaded jasper UI and took a screenshot of response header for jquery.jcrypton.js from the location (Jasper Home)/scripts/bower_components/jCrypton/ and captured its last modified
    5. response header for jquery.jcrypton.js

    6. Later added an alert in the same file and saved.
    7. Re-executed the jasper URL and taken the screenshot.

Re-executed the jasper url

This concludes, the server is giving first preference to last modified files and then expire flag.


Best Open Source Business Intelligence Software Helical Insight is Here


A Business Intelligence Framework

In case if you have any queries please get us at support@helicaltech.com

Thank You
Rupam Bhardwaj
Helical IT Solutions Pvt Ltd

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments