Stefan Riegel schrieb:
Hello all,

we are using Apache Tomcat 5.5.16 on both a Windows (development) and Linux (production) system. Caching of static resources works fine but we should control the behavior. We use a filter, which transforms static xml files and inserts some data.

The access log shows clearly that all static resources are cached.

127.0.0.1 - don [18/Jan/2007:00:04:58 +0100] "GET /hospi2007/index.xms? HTTP/1.1" 304 - 127.0.0.1 - don [18/Jan/2007:00:04:58 +0100] "GET /hospi2007/stylesheet.jsp? HTTP/1.1" 200 1429 127.0.0.1 - don [18/Jan/2007:00:04:58 +0100] "GET /hospi2007/leftbg.gif? HTTP/1.1" 304 -

The XSLT filter did manipulate the xml content from the "index.xms" but of course nothing shows up in Mozilla 2.0.0.1. Better said: it did not manipulate anything because the writer (a char buffer) of the wrapped response does not contain anything. (By the way. With the latest IE it is nothing caching at all and everything works as expected).

Don't worry about our special filter implementation. The caching appears already with simple HTML pages which does not pass the filter:

127.0.0.1 - don [18/Jan/2007:00:26:31 +0100] "GET /hospi2007/index.html? HTTP/1.1" 304 -

And exactly here we would like to disable the caching.

Meta tags did not help:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META content="no-cache" http-equiv="pragma" >
<META content="no-cache, must-revalidate" http-equiv="Cache-Control" >
<META content="0" name="Expires" >
<title>Hello World</title>
</head>
<body>
   <h1>Hello World</h1>
</body>
</html>

Context configuration did not help neither:

<Context cacheMaxSize="1" cacheTTL="1" cachingAllowed="false" reloadable="true">

We thought about changing the request header "if-modified-since" somewhere in the XSLT filter, but did not find a way to do this.

We thought even about to substitute the static xml pages with jspx pages. This works fine, but we got problems with the "&amp;" entity. Jsp substitutes the entities with "&" which breaks the XML.

Any suggestion for a clean and simple solution?

Regards
Stefan

Hi Chris,

the HTML META tags above do not change the browsers request behavior at all. Their must be something strange with tomcats caching or with the mozilla requests. Is it something wrong with my context attributes above? With this configuration, tomcat should not cache static resources (see http://tomcat.apache.org/tomcat-5.5-doc/config/context.html).

Thunderbird request headers with and without the META tags above:

host: localhost:8080
user-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1 accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
accept-language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
accept-encoding: gzip,deflate
accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
keep-alive: 300
connection: keep-alive
if-modified-since: Wed, 17 Jan 2007 22:56:34 GMT
if-none-match: W/"1242-1169074594484"
authorization: Basic ZG9uOmVzdGViYW4=
cache-control: max-age=0

MS IE 7.0 request headers without the META tags above:

accept: */*
accept-language: de
ua-cpu: x86
accept-encoding: gzip, deflate
user-agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.1)
host: localhost:8080
connection: Keep-Alive
cookie: JSESSIONID=1964AE122DC80DBC7A692B4FC1941343
authorization: Basic ZG9uOmVzdGViYW4=

First, I suspected the if-modified-since header to control the caching. So I did send a last-modified header from 1970 in the response. Mozilla does a good job and started sending this old date in the if-modified-since header. But Tomcat is still caching. Nogood.

Second, I played with modifying the etag and if-none-match respons headers. Still caching.

Very strange. Their must be a simple method to prevent caching regardless of browser requests. Any idea?

Thank you
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