--- /home/hubick/data/eclipse-workspace/tomcat-trunk/java/org/apache/naming/resources/DirContextURLConnection.java (revision 661450) +++ /home/hubick/data/eclipse-workspace/tomcat-trunk/java/org/apache/naming/resources/DirContextURLConnection.java (working copy) @@ -39,6 +39,7 @@ import org.apache.naming.JndiPermission; import org.apache.naming.resources.Resource; import org.apache.naming.resources.ResourceAttributes; +import org.apache.tomcat.util.http.FastHttpDateFormat; /** * Connection to a JNDI directory context. @@ -222,6 +223,16 @@ } + protected String getHeaderValueAsString(Object headerValue) { + if (headerValue == null) return null; + if (headerValue instanceof Date) { + // return date strings (ie Last-Modified) in HTTP format, rather than Java format + return FastHttpDateFormat.formatDate(((Date)headerValue).getTime(), null); + } + return headerValue.toString(); + } + + /** * Returns an unmodifiable Map of the header fields. */ @@ -248,7 +259,8 @@ ArrayList attributeValueList = new ArrayList(attribute.size()); NamingEnumeration attributeValues = attribute.getAll(); while (attributeValues.hasMore()) { - attributeValueList.add(attributeValues.next().toString()); + Object attrValue = attributeValues.next(); + attributeValueList.add(getHeaderValueAsString(attrValue)); } attributeValueList.trimToSize(); // should be a no-op if attribute.size() didn't lie headerFields.put(attributeID, Collections.unmodifiableList(attributeValueList)); @@ -285,7 +297,8 @@ if (attributeID.equalsIgnoreCase(name)) { Attribute attribute = attributes.get(attributeID); if (attribute == null) return null; - return attribute.get(attribute.size()-1).toString(); + Object attrValue = attribute.get(attribute.size()-1); + return getHeaderValueAsString(attrValue); } } } catch (NamingException ne) {