tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <j...@kewlstuff.co.za>
Subject Re: Etags vs Week Etags
Date Wed, 03 Sep 2008 19:51:44 GMT

----- Original Message ----- 
From: "Yoryos" <valotas@gmail.com>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Wednesday, September 03, 2008 8:57 PM
Subject: Re: Etags vs Week Etags


> On Wed, Sep 3, 2008 at 8:12 PM, Johnny Kewl <john@kewlstuff.co.za> wrote:
>
>>
>> Flipping good question... and I have a feeling that there is some
>> philosophy in the answer... reasons for the way it done...
>> The short answer is that you cant (I think)... the default servlet makes 
>> em
>> weak (thats the philamamasomamy)...
>> That first section (strong) does nothing... the reason is that the 
>> setEtag
>> method is there but as far as i can tell, never ever called by anything 
>> in
>> Tomcat.
>> Its a hook...
>>
>> But stay calm... there are ways...
>>
>> This clever guy did this...
>>
>> http://blog.bcarlso.net/articles/2007/10/19/tomcat-weak-etags-and-javascript-css-caching
>>
>> He is basically overriding the default servlet stuff to get things 
>> done....
>> its smart, he knows his tomcat, but personally I dont like it...
>>
>> I think the generic problem is that a static resource cant control its
>> Etag... its a dumb image, and secondly no matter what a web server does,
>> another web server is going to do it different, so strong loses its 
>> meaning
>> (more philamamasomamy)... or more simply, you just got to do it 
>> yourself...
>>
>> I would prefer (or try, I havnt giving this a go)... make a little 
>> servlet,
>> set the Etag headers yourself, map it to all the static resources you 
>> want
>> to control...
>> And then do what you have to
>>
>> getContentLength() + "-" + getLastModified() + IncludeFiles() +
>> IncludedImages() + WhateEver() "\"";
>>
>> etc... I think thats easiest...
>>
>> The philamamasomamy on why TC chose to make it weak would be interesting 
>> to
>> hear, but I do think that any serious scheme... on its way to some kind 
>> of
>> private RSS system... will be doing its own thing.
>>
>> Have fun... nice question
>>
>>
> Well a quick solution is to extend the DefaultServlet to apply a "good"
> etag. But then I should also check for this etag in case I have a request
> with headers If-None-Match. This means that I should also extend the
> org.apache.naming.resources.ResourceAttributes
> class in order to be giving me a "good" etag.
> I don't really care about the philosophy of using week etags. I'm sure 
> there
> is one but as I can see there isn't any easy way of letting the user 
> decide
> the default headers of static content except from reinventing the wheel
> (creating a custom DefaultServlet) and I think this is a problem as the
> implementation of a new DefaultServlet isn't as easy as it seems to be.

I would try front end servlet, or a filter before massaging default 
servlet...
but I agree, there is a lot of functionality in that deafult servlet that 
could be brought out...
As options and as extended tools in normal servlets.

Probably has a lot to do with following Suns specs to the letter, which is a 
good thing I guess.
For example if you want XSLT in tomcat, first impression is its xerces and a 
complex servlet and lots of pain... you actually think tomcat cant do it, 
but then you look at the default servlet and "Obama!" its there ;) I call it 
TC's hidden gold mine ;)

---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
--------------------------------------------------------------------------- 


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


Mime
View raw message