tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 45735] New: Updated ResourceAttributes.getETag
Date Wed, 03 Sep 2008 17:48:24 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=45735

           Summary: Updated ResourceAttributes.getETag
           Product: Tomcat 6
           Version: 6.0.18
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: remm@apache.org


After looking at a user's list post, I noticed the implementation was not
consistent with the other getters (like getName).

I propose changing it to:
    public String getETag(boolean strong) {
        if (strong) {
            // The strong ETag must always be calculated by the resources
            if (strongETag != null)
                return strongETag;
            if (attributes != null) {
                Attribute attribute = attributes.get(ETAG);
                if (attribute != null) {
                    try {
                        strongETag = attribute.get().toString();
                    } catch (NamingException e) {
                        ; // No value for the attribute
                    }
                }
            }
            return strongETag;
        } else {
            // The weakETag is contentLenght + lastModified
            if (weakETag == null) {
                weakETag = "W/\"" + getContentLength() + "-" 
                    + getLastModified() + "\"";
            }
            return weakETag;
        }
    }


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message