tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Johnny Kewl" <>
Subject Re: Etags vs Week Etags
Date Wed, 03 Sep 2008 20:09:43 GMT

----- Original Message ----- 
From: "Johnny Kewl" <>
To: "Tomcat Users List" <>
Sent: Wednesday, September 03, 2008 9:51 PM
Subject: Re: Etags vs Week Etags

> ----- Original Message ----- 
> From: "Yoryos" <>
> To: "Tomcat Users List" <>
> 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 <> 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...
>>> 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 ;)

Actually Yoryos... if you do decide on the overload method, been there tried 
that, its not really designed for it, its actually easier to isolate the 
whole servlet...
ie just steal the code and make another servlet... packaging gets a little 
trick but the resulting solution is very small.
Thats how I fixed WebDav, which is another thing hiding in that gold mine ;)
It that case its not broken, but MS broke the spec, so Java guys say MS... 
you fix it, and MS says, we own the planet, so go play in Georgia... what I 
did is make one that works with both... so probably not a bad thing getting 
into it anyway... lots of good stuff there ;)
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action :

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

View raw message