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 –
- Take the back up of applicationContext-webapp.xml from location
- Copy the provided applicationContext-webapp.xml to the location –
- Clear work and Temp directory
- Restart the tomcat server.
(Jasper Home)/WEB-INF/
(Jasper Home)/WEB-INF/
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::
- when executing jasper login URL in the browser for the first time-
- Jasper UI loaded the second time –
- When there is any change in the static files –
- For this, we had made below change in js.config.properties file present inside (Jasper Home)/WEB-INF/
- Restarted the tomcat server
- 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
- Later added an alert in the same file and saved.
- Re-executed the jasper URL and taken the screenshot.
javascript.optimize = false
This concludes, the server is giving first preference to last modified files and then expire flag.
![logo](https://www.helicaltech.com/wp-content/uploads/2019/01/Quotes.png)
Best Open Source Business Intelligence Software Helical Insight is Here
![logo](https://www.helicaltech.com/wp-content/uploads/2019/01/logo.png)
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