View | Details | Raw Unified | Return to bug 45101
Collapse All | Expand All

(-)/home/hubick/data/eclipse-workspace/tomcat-trunk/java/org/apache/naming/resources/DirContextURLConnection.java (-2 / +15 lines)
Lines 39-44 Link Here
39
import org.apache.naming.JndiPermission;
39
import org.apache.naming.JndiPermission;
40
import org.apache.naming.resources.Resource;
40
import org.apache.naming.resources.Resource;
41
import org.apache.naming.resources.ResourceAttributes;
41
import org.apache.naming.resources.ResourceAttributes;
42
import org.apache.tomcat.util.http.FastHttpDateFormat;
42
43
43
/**
44
/**
44
 * Connection to a JNDI directory context.
45
 * Connection to a JNDI directory context.
Lines 222-227 Link Here
222
    }
223
    }
223
    
224
    
224
225
226
    protected String getHeaderValueAsString(Object headerValue) {
227
        if (headerValue == null) return null;
228
        if (headerValue instanceof Date) {
229
            // return date strings (ie Last-Modified) in HTTP format, rather than Java format
230
            return FastHttpDateFormat.formatDate(((Date)headerValue).getTime(), null);
231
        }
232
        return headerValue.toString();
233
    }
234
235
225
    /**
236
    /**
226
     * Returns an unmodifiable Map of the header fields.
237
     * Returns an unmodifiable Map of the header fields.
227
     */
238
     */
Lines 248-254 Link Here
248
              ArrayList attributeValueList = new ArrayList(attribute.size());
259
              ArrayList attributeValueList = new ArrayList(attribute.size());
249
              NamingEnumeration attributeValues = attribute.getAll();
260
              NamingEnumeration attributeValues = attribute.getAll();
250
              while (attributeValues.hasMore()) {
261
              while (attributeValues.hasMore()) {
251
                  attributeValueList.add(attributeValues.next().toString());
262
                  Object attrValue = attributeValues.next();
263
                  attributeValueList.add(getHeaderValueAsString(attrValue));
252
              }
264
              }
253
              attributeValueList.trimToSize(); // should be a no-op if attribute.size() didn't lie
265
              attributeValueList.trimToSize(); // should be a no-op if attribute.size() didn't lie
254
              headerFields.put(attributeID, Collections.unmodifiableList(attributeValueList));
266
              headerFields.put(attributeID, Collections.unmodifiableList(attributeValueList));
Lines 285-291 Link Here
285
                if (attributeID.equalsIgnoreCase(name)) {
297
                if (attributeID.equalsIgnoreCase(name)) {
286
                    Attribute attribute = attributes.get(attributeID);
298
                    Attribute attribute = attributes.get(attributeID);
287
                    if (attribute == null) return null;
299
                    if (attribute == null) return null;
288
                    return attribute.get(attribute.size()-1).toString();
300
                    Object attrValue = attribute.get(attribute.size()-1);
301
                    return getHeaderValueAsString(attrValue);
289
                }
302
                }
290
            }
303
            }
291
        } catch (NamingException ne) {
304
        } catch (NamingException ne) {

Return to bug 45101