Hi all,
I don't know if I should be postting the the dev list but let's try from
here.
I'm trying to understand how the etag are being applying to the static
resources. My problem is that I would like to get rid of the week etags,
that tomcat is applying. After a little bit of searching I ended up to the
org.apache.naming.resources.ResourceAttributes class where I found the
getETag(boolean strong) method. It's a very small method but I didn't
understand a small thing. Well the method is the above:
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;
}
And my question is what the first if condition stand's for. Even if we'll
get an etag value (result = attribute.get().toString();), exatly after the
first if block, we get if / else blocks witch results to overriding the
previous result value to a strongETag or a weekETag!
What made me trying to find what is going on is that I always get week etags
for my static resources, witch is something I whould like to overcome as
some browsers doesn't handle them really well.
Thank you!