You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "nospam@wolterinkwebdesign" <no...@wolterinkwebdesign.com> on 2007/05/22 18:21:19 UTC

Re: [solved] Tomcat and Static file Caching ( 304 headers )

Sorry to your all.. Tomcat does do correct caching..
The way that firebug displays this is a bit strange..

My fault

nospam@wolterinkwebdesign schreef:
> Well we are talking about static js files that do not change often.
> If was thinking about writing my own filter that created the
> correect header fields... But i think it is really a responsibility of 
> the
> application server to support client caching for static files..
>
> It looks like tomcat does not do that.. at least not for javasdcript 
> files..
> Or the firebug firefox util is f*cked up...
> I will investigate this case.. because i think Tomcat DOES support
> cahcing ( at least if i look at the code of DefaultServlet that handles
> the static files in tomcat )..
> But strangely enough it does not work for me..
>
>
> Johnny Kewl schreef:
>> I just had an after thought... happens often ; )
>> I think because you using feed type technology the assumption is that 
>> is wot you really want,
>> but if this js file never changes... then wot about trying normal 
>> caching constructs like
>>
>> please check the actual format...
>>     Cache-control: public, max-age=3600
>> I think that will cache the js page for one hour.... alot easier than 
>> hashing pages and all the other fancy stuff in feeds.... maybe.
>>
>> ----- Original Message ----- From: "Johnny Kewl" <jo...@kewlstuff.co.za>
>> To: "Tomcat Users List" <us...@tomcat.apache.org>
>> Sent: Tuesday, May 22, 2007 3:55 PM
>> Subject: Re: Tomcat and Static file Caching ( 304 headers )
>>
>>
>>> Hi... I dont know much about this, never had a chance to play with 
>>> it... dont even
>>> know how much Tomcat does for you and how much is manual header 
>>> manipulation.
>>> But just from below... there seems to be nothing in the browser 
>>> response telling the server
>>> that it understands feed caching... ie one would expect to see
>>> Last-Modified:  or Etag... so just guessing but I dont think the 
>>> browser understands it..
>>> maybe you should try Last-Modified....
>>>
>>> I found a fairly decent article.... maybe will help... 
>>> http://rakaz.nl/item/reducing_the_bandwidth_used_by_feeds
>>>
>>> ----- Original Message ----- From: "nospam@wolterinkwebdesign" 
>>> <no...@wolterinkwebdesign.com>
>>> To: <us...@tomcat.apache.org>
>>> Sent: Tuesday, May 22, 2007 2:17 PM
>>> Subject: Tomcat and Static file Caching ( 304 headers )
>>>
>>>
>>>> I am using Tomcat 5.5 together with Eclipse 3.2.2 for development
>>>> of a web application.
>>>>
>>>> But when i use FireBug in Firefox to track network traffic is
>>>> see that tomcat never returns a 304 NOT MODIFIED header
>>>> if a file is requested twice.
>>>>
>>>> For example when requesting a JavaScript file:
>>>> http://localhost:8080/XDataSystem/standard/js/standard.js
>>>> you see the following headers:
>>>>
>>>> *Response Headers*
>>>> Server Apache-Coyote/1.1
>>>> Etag W/"10823-1179768573406"
>>>> Last-Modified Mon, 21 May 2007 17:29:33 GMT
>>>> Content-Type text/javascript
>>>> Content-Encoding gzip
>>>> Vary Accept-Encoding
>>>> Date Tue, 22 May 2007 11:52:27 GMT
>>>
>>>> *Request Headers*
>>>> Host localhost:8080
>>>> User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv:1.8.1.3)
>>>> Gecko/20070309 Firefox/2.0.0.3
>>>> Accept */*
>>>> Accept-Language nl,en-us;q=0.7,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
>>>> Referer http://localhost:8080/XDataSystem/rainbow/home.page
>>>>
>>>>
>>>>
>>>> As you can see in the response filter i have turned GZIP 
>>>> compressoin on.
>>>>
>>>> But when i request the page again ( by typing the url in the url-bar,
>>>> NOT using F5 )
>>>> I get the exact same response back.. But i expect a 304 response.
>>>>
>>>> I think it has something to do with the Vary response field.
>>>> I have read this:
>>>> http://localhost:8080/XDataSystem/standard/js/standard.js
>>>>
>>>> But i do not understand it fully.
>>>>
>>>> can anybody help me??
>>>> This really makes my application ( using dojo ) slow.
>>>>
>>>> Thanks in advance.
>>>>
>>>> Tjerk Wolterink
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


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