tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: How do you set cache-control for static (gif, jpg) resources
Date Fri, 30 Jul 2004 13:40:12 GMT


>Previously I was calling doChain at the end of my doFilter method.
>Making the change you suggest, calling doChain at the top like
<snip />
>DOES NOT INSERT any of my changes into the response stream. If I do it
<snip />
>Then I get two additions in the response stream.
>Any more ideas?

That's a bit strange.  Are you wrapping the response or setting these
headers elsewhere?  Can you print out to the log a listing of all the
response headers at the end of your filter?

The addHeader method allows for multiple values, but many readers will
only see the first.  So if something in your code sets the cache-control
header, then you call it again, the header will be present twice with
two values (which is legal in the HTTP protocol for most headers).

As an aside, you can read the enumeration of the init parameters in the
filter's init method, store it in some member variable, and that will
improve the performance of your filter because you won't have to do it
on every request.

Yoav Shapira

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

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

View raw message