Yory, I'm tired pulling long hours on something, so please check me ;)

Yes, not needed, its another hook... coder has left it there in case he
needs it...
In theory, when I look at the code, all you really have to do is
setEtag.... and that will be used.
If you leave the W/\"" off... its a strong tag....

or if you
if (strong)
              weakETag = getContentLength() + "-" + getLastModified() +
"\"";

I think you done... TC will now do strong tags

To understand whats going on with that stuff... attributes is a bunch of
collections.
They way its being used is when you drop a static resource into tomcat
theres a war engine somewhere that detects it...
When that happens... they stick things in there like ContentLength and
LastModified... ie the file attributes...
And then they use the collections to compute the eTag...
That getContentLength() function is also using those "memory" of
attributes...

Its a hash map so you can add whatever you need to it.... thus he has left
the hook in there...

Then things like
checkIfNoneMatch and all the rest should be in the default servlet... and
they will all call into the above, so if your
etag is there... thats going to be used...

In that link ( the clever guy link) all he is doing is getting at the
setETag function... which comes back as
strongETag
and he is getting the stuff out of the collections so that
he doenst have to recheck the static resource last mod time etc... but
equally he could have added something... and then the hook gets useful...

It does look unfinished, but this ETag stuff is difficult... say for
example you have a JSP file and that includes other JSP files... how would
you code that so that humble users can do it.... probably end up just
leaving a hook in there as well, for high IQ systems ;)

Remy Maucherat is the default servlet guy... hopefully he can confirm

Have fun...


Thanks for the answer!
As I've seen tomcat does not ad the etag header to jsps and other servlets. That should be the work of the programmer of the servlet. The only thing it
does is addind this header to the static content.

The solution of the clever guy does not seem to work! At least not in tomcat 6 (that I am using, but didn't test it on 5). As I've seen tomcat let's you define an implementation of the context it can use. The only problem is that
FileDirContext witch overides this clever guy does not implement all the
interfaces it should in order to "work" as a context. Form the other side
StandardContext witch should be extended in order to get something working
does some casting to FileDirContext depending the request.

Anyway I'll try to find a "portable" solution as I wouldn't like to hack the
source of the tomcat in order to have strong etags.

Thank you for your help and time!

Yory, had some sleep... ha ha
Yes you right... actually meant to say jsp files that include html files...

Anyway, listen before you give up on this, drop me a email because its something that I'm interested in... You see that (now not so clever guy) is aiming at the default servlet... but this technology is also the basis of super RSS type stuff... thats my interest.
Thats why I think it has to be done in a frontend servlet...

For example... default will pick up on changes in images htm etc... but what happens when you have a JSP that pulls 500k from a dB... If you wanted to make that efficient... then the JSP page doesnt matter, whether or not the data in the recordset changes for the same query matters... so thats what would be in the Etag.... and that means one could build very efficient sites.

Say you have a ajax site that displays a file structure... and you only want it to send all that stuff if the section is changed... Its way beyond simple Etags... ie I think you want to be able to cover other servlets and JSP as well... Etags actually dont go much further than normal browser caching in the default servlet implementation.

Let me know what it is you actually trying to do, and if it comes close to my interest in it... you'll get the code for nothing ;)

regards...

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