On Wed, Sep 3, 2008 at 11:09 PM, Johnny Kewl <[EMAIL PROTECTED]> wrote:
> > ----- Original Message ----- From: "Johnny Kewl" <[EMAIL PROTECTED]> > To: "Tomcat Users List" <users@tomcat.apache.org> > Sent: Wednesday, September 03, 2008 9:51 PM > > Subject: Re: Etags vs Week Etags > > > >> ----- Original Message ----- From: "Yoryos" <[EMAIL PROTECTED]> >> 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 <[EMAIL PROTECTED]> >>> 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 can anyone also explain to me the first if block of code here: public String getETag(boolean strong) { String result = null; if (attributes != null) { Attribute attribute = attributes.get(ETAG); if (attribute != null) { try { result = attribute.get().toString(); } catch (NamingException e) { ; // No value for the attribute } } } if (strong) { // The strong ETag must always be calculated by the resources result = strongETag; } else { // The weakETag is contentLenght + lastModified if (weakETag == null) { weakETag = "W/\"" + getContentLength() + "-" + getLastModified() + "\""; } result = weakETag; } return result; } I think it is not realy needed!