tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith Bottner" <>
Subject RE: How do you set cache-control for static (gif, jpg) resources
Date Fri, 30 Jul 2004 13:18:17 GMT
Ok, I wrote a simple filter. No problem. It works!

One question. Is there a standard way to determine if your filter is being
called during the request chain or during the response chain?

If I use

response.putHeader(headerName, fc.getInitParameter(headerName));

It will add the header once during the request chain and once during the
response chain, therefore, anything I add is in their twice.

If I use

response.setHeader(headerName, fc.getInitParameter(headerName));

It will overwrite the current setting, but setting the value twice just
seems like bad form. If I could detect which chain is currently being
processed then I could only insert it once.



-----Original Message-----
From: Keith Bottner [] 
Sent: Friday, July 30, 2004 7:53 AM
Subject: How do you set cache-control for static (gif, jpg) resources

I am trying to find out how I can set my static content for images,
javascript and css to have a different cache-control setting. It appears
that Tomcat always returns Cache-Control: no-cache with every response. I
want to specify certain static resources such as gif and jpg to have
Cache-Control: public,max-age=7200.
Does anyone know how to configure Tomcat to do this? I have Googled
everywhere with no luck!

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

View raw message