I have a js
file which is cached between 5-10 minutes, depending on whether I'm using tomcat from the eclipse (via GWT plugin) or starting tomcat as standalone.
This is strange as I'm using GWT
as my framework and this file should not be cached at all (it's a nocache.js file to those of you who know GWT).
I've read on a GWT Google group thread that it's a container configuration issue, and somewhere else that it's something I need to define in the containing HTML file.
Basically, I'm confused right now as I have no clue on how to get this file to not cache.
Please note that this js is generated by GWT
and I cannot modify it.
Thanks for any help, Ittai
Using a javax.servlet.Filter
One way to do this in a portable way (across different app servers), is using Filters. In your web.xml add the following:
Then implement your MyHeadersFilter like:
Optional: Configurable Filters
You can also make your filter configurable from your web.xml, by using
<init-param>
s:Add the following to MyHeadersFilter:
That makes it possible to access your init-param(s) using:
There is a Filter available in tomcat 7
You can find more details here
https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/filters/ExpiresFilter.html