Reputation: 7363
Is it possible to apply different cache-control in the HTTP header response for specific files in a web app running on Tomcat? I'm looking to do so from the web app without having to change Tomcat's configuration since those settings change with each deployment.
For instance, here's an example of what I want:
I appreciate your answers.
Thanks
Upvotes: 1
Views: 1902
Reputation: 3472
This is a definitely a job for ServletFilters as they allow you to intercept requests.
This way you can easily set the correct HTTP Headers for caching
I started writing a solution to this a few minutes ago using two ServletFilters.
One filter to cache the resources and one not to cache them.
However, I stumbled upon cache-filter and it already does the job for you...
It looks like you need to point your Never cache resources to the
And the cachable resources to the
Upvotes: 5