There have been at least 3 different highly intelligent people so far that
have urged you to implement this behavior with a Filter. After this email
there are going to be 4 (but still only 3 highly intelligent) people that
urge you to use a Filter for what you're trying to accomplish.
There are many reasons for using a Filter.
1.) It is APPLICATION behavior that requires your pages not to be cached.
Not server behavior. Meaning, that if you take your application and install
it on a different server it will not behave correctly.
2.) META Tags for controlling cache behavior DO NOT WORK. The reason that
they don't work is that the servers between your application and your
browser only look at the header values of a request for caching. They
(being the intermediary servers) do not inspect the actual message itself to
read the META Tags. Finally the browser itself almost always looks at the
header cache values instead of the META Tags.
Whew...
3.) Using a Filter you can program different logic for different caching
strategies for different media types. For example, the JSP itself might not
ever want to be cached, but images on the other hand...we would only want
them requested once and then be cached. Just and example.
So, to finish up this email...
Use a filter, it just works.
public class CacheControlFilter implements Filter
{
public void init(FilterConfig config) {}
public void destroy() {}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) throws IOException, ServletException
{
httpResponse.addHeader("Cache-Control", "no-chache, no-store,
must-revalidate, max-age=0, proxy-revalidate, no-transform, pre-check=0,
post-check=0, private");
filterChain.doFilter(request, response);
}
}
----Original Message Follows----
From: <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: Tomcat Users List <users@tomcat.apache.org>, [EMAIL PROTECTED]
Subject: Re: Http Header Cache-Control
Date: Fri, 27 Jul 2007 09:17:54 -0500 (CDT)
Hi,
I'm still studying this problem. While checking the
HTML SPEC
(http://www.w3.org/TR/html4/struct/global.html#h-7.4.4),
I find the following:
---------------------------------------------------
META and HTTP headers
The http-equiv attribute can be used in place of the
name attribute and has a special significance when
documents are retrieved via the Hypertext Transfer
Protocol (HTTP). HTTP servers may use the property
name specified by the http-equiv attribute to create
an [RFC822]-style header in the HTTP response. Please
see the HTTP specification ([RFC2616]) for details on
valid HTTP headers.
The following sample META declaration:
<META http-equiv="Expires" content="Tue, 20 Aug 1996
14:25:27 GMT">
will result in the HTTP header:
Expires: Tue, 20 Aug 1996 14:25:27 GMT
--------------------------------------------------
Therefore, I'm confused. What's the exact meaning of:
"HTTP servers may use the property name specified by
the http-equiv attribute to create an [RFC822]-style
header in the HTTP response."
Does this means that Tomcat is ignoring this "may"
part of the specification?
I actually tried to add that meta tags in my document
but still not getting that in the hppt header.
Thanks.
--- [EMAIL PROTECTED] escribió:
> I've got a great link for solving this problem. Take
> a
> look at it. Hope that helps somebody.
>
>
>
http://www.onjava.com/pub/a/onjava/2004/03/03/filters.html
>
>
>
>
> --- Christopher Schultz
> <[EMAIL PROTECTED]>
> escribió:
>
> > To whom it may concern,
> >
> > [EMAIL PROTECTED] wrote:
> > >> Something is wrong with that mod_jk version, by
> > the way. The most
> > >> recent release of mod_jk is 1.2.23.
> > >
> > > Well, the installation file that I found in the
> > server is named:
> > > mod_jk-3.3-ap20.so, that's why I assumed that
> > version.
> >
> > Strange. You must have some odd packaged version
> of
> > apache + mod_jk that
> > has its own (confusing) version number.
> >
> > > This [filter] method looks really cool, any way,
> > does somebody knows
> > > another solution. I read about configuring
> apache
> > http.conf and/or
> > > installing the headers module.
> >
> > I'm sure you can do something like this using
> Apache
> > httpd only, I'm
> > just not sure how to do it.
> >
> > > Is that filter installation the only way in
> which
> > this could be
> > > achieved with tomcat??
> >
> > There are other ways, but this is the most
> > convenient. Tomcat itself
> > does not support anything like this (that I know
> > of), so you basically
> > have to solve this at an application level.
> >
> > Hope that helps,
> > -chris
> >
> >
>
>
>
>
>
____________________________________________________________________________________
> ¡Sé un mejor fotógrafo!
> Perfecciona tu técnica y encuentra las mejores
> fotos.
> http://mx.yahoo.com/promos/mejorfotografo.html
>
>
---------------------------------------------------------------------
> To start a new topic, e-mail:
> users@tomcat.apache.org
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
>
>
____________________________________________________________________________________
¡Sé un mejor besador!
Comparte todo lo que sabes sobre besos.
http://mx.yahoo.com/promos/mejorbesador.html
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
http://newlivehotmail.com
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]