tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan <>
Subject Context attribute "cachingAllowed" does not work as expected. Is this a bug?
Date Mon, 12 Feb 2007 21:36:13 GMT

to continue the development of our web application it is crucial to
avoid caching of some static resources (server side) regardless of
request headers send by clients. I did not succeed nor do I have any
idea, what to try next. I start to assume either a bug/weakness of
tomcat or a weakness in my brain.

Exhaustive searches of the web (Google and tomcat mailing archives) did
not help. Answers to my posting
did not help either. My last posting
did not generate any feedback. So I start to suspect, that I have some
basic misunderstanding of things.

Please could someone help to bring me on the right track?

Out of the box installation of tomcat 5.5.20 on Windows (development)
and Suse Linux 9.3 (production). A hello world index.html file. The
following context configuration:

<Context cachingAllowed="false" reloadable="true">
    <!-- Default set of monitored resources -->
        <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="localhost_access_log."
                 pattern="common" resolveHosts="false"/>

Problem reproduction:
Just request the index.html with Firefox and watch the access log. - don [12/Feb/2007:20:34:08 +0100] "GET /hospi2007/index.html
HTTP/1.1" 304 -

But the status code should be 200 and not 304. Look what IE with the
standard configuration does: - don [12/Feb/2007:20:35:04 +0100] "GET /hospi2007/index.html
HTTP/1.0" 200 388

or Firefox with Disabled Cache - don [12/Feb/2007:20:35:04 +0100] "GET /hospi2007/index.html
HTTP/1.0" 200 388


Did I understand the tomcat documentation right?
"cachingAllowed: If the value of this flag is true, the cache for static
resources will be used. If not specified, the default value of the flag
is true."

That means once set to false, that tomcat will not cache any static
resources like the index.html page regardless which headers the client
sends. So tomcat should not send the status code 304.

Is this correct?

I really would appreciate a answer which helps me to find the right
direction. I saw you solving complicated problems in this list and this
here seems so simple...I guess I have some misunderstanding but really
can't figure out what it is. I tried for days many work arounds but I
cannot believe that I have to "pollute" our application with changing
URL-postfixes/-parameters or to bother the sever with cron jobs
"touching" files to change the modification time.

By the way. This non-caching makes problems inside a XSLT servlet filter

StringResponseWrapper pageResponseWrapper = new
StringResponseWrapper((HttpServletResponse) response);
chain.doFilter(request, pageResponseWrapper);
// Do nothing if browser has cached the response
if (pageResponseWrapper.toString().length() > 0) {
  // Transform the response and more. The tranformation includes some
dynamic stuff.
  // Assume a current time stamp for example. It's what I just use for
testing purpose.

The getWriter method inside the response wrapper is not even called by
cached responses.

So thank you in advance


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message