Hello,

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
http://www.nabble.com/Cache-problems-with-static-resources-tf3031321.html#a8422512
did not help either. My last posting
http://www.nabble.com/Why-does-this-not-work-with-Thunderbird-1.5.0.9--%3CContext-cacheMaxSize%3D%221%22-cacheTTL%3D%221%22-cachingAllowed%3D%22false%22%3E-tf3205171.html#a8900300
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?

Prerequisite:
------------
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 -->
   <WatchedResource>WEB-INF/web.xml</WatchedResource>
       <Valve className="org.apache.catalina.valves.AccessLogValve"
                directory="logs"  prefix="localhost_access_log."
suffix=".txt"
                pattern="common" resolveHosts="false"/>
</Context>

Problem reproduction:
----------------------
Just request the index.html with Firefox 2.0.0.1 and watch the access log.
127.0.0.1 - 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:
127.0.0.1 - don [12/Feb/2007:20:35:04 +0100] "GET /hospi2007/index.html
HTTP/1.0" 200 388

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

Question:
---------

Did I understand the tomcat documentation right?
http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
"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
implementation:

...
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
Stefan

--
Stefan



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to