I have a Struts2 (version 2.2.6) web application where I want to set the Expires response header for static resources that are not present in the traditional static-related folders for struts2. E.g. they are placed under /images/, /css/, /js/ at the root. I want all the resources to have a custom Expires response header.
How to do this in Struts2?
So based on the hint provided by @Dave I have come up with a following approach.
In web.xml setup following filter & it’s mapping.
And the
StaticContentCacheHeaderwhichimplements Filterhas the following method –This will set the cache headers to expire in one month from now.
Let me know if there is a better way to deal with this.