David Chisholm wrote:

> [snip]
> I was using the following to disable caching in all of my pages:
>
>   response.setHeader("Pragma", "No-cache");
>   response.setHeader("Cache-Control","no-cache" );
>   response.setHeader("Cache-Control","no-store" );
>   response.setDateHeader("Expires", 0);
>   Date dateInPast = new Date(0);
>   response.setDateHeader("ExpiresAbsolute", dateInPast.getTime());
>

One possible issue that is very definitely servlet related is the way your servlet
engine implements the response.setHeader() method.  In many servlet engines, only
one header with a specified header name is saved, which (if it happened to you)
would mean that your first "Cache-Control" setting (no-cache) was not being kept.

In the 2.2 API, a new set of methods (such as addHeader()) was added to
HttpServletResponse to deal with the fact that some HTTP headers may legally be
included more than once.

For the record, I include the following three headers when I want to disable
caching.  I haven't exhaustively tested every possible case, but they seem to work
for me:

    response.setHeader("Pragma", "No-cache");
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0);

(I got this list from a SERVLET-INTEREST message several months ago.)

Craig McClanahan

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to