tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Applying a servlet filter to a static resource
Date Thu, 11 Mar 2010 20:00:09 GMT
Pid wrote:
> On 11/03/2010 14:38, Matt Veitas wrote:
>> If I
>> could modify the calling code to hit a servlet instead of the static
>> resource, I could use that servlet to read the static resource (JSON),
>> perform some business logic and modify the JSON, and return that to the
>> client, but unfortunately I can't change the calling url.
I missed this the first time around, but you can do that, and you would 
not have to modify the calling URL.

Use a servlet instead of a filter, and (to my knowledge) there is 
nothing stopping you from mapping your servlet to


In order for the above to map exactly to the URL
I think you would have to put this servlet inside the ROOT (default) webapp.
Then make sure that when this servlet returns the response, it sets the 
appropriate HTTP headers to forbid the client browser (or any caching 
entity in-between) from caching the result.
I do not remember all the headers that play a role there, but two of 
them are
Expires: 0   (or better, the date of yesterday in the correct format)
Cache-Control: no-cache

Check in RFC2616, sections 13 and 14

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message