protected PathAttributes toAttributes(final DavResource resource) { final PathAttributes attributes = super.toAttributes(resource); final Map<QName, String> properties = resource.getCustomPropsNS(); if(null != properties && properties.containsKey(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)) { final String value = properties.get(MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE); if(StringUtils.isNotBlank(value)) { try { attributes.setModificationDate(rfc1123.parse(value).getTime()); } catch(InvalidDateException e) { log.warn(String.format("Failure parsing property %s with value %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE, value)); if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } else { if(log.isDebugEnabled()) { log.debug(String.format("Missing value for property %s", MicrosoftIISDAVTimestampFeature.LAST_MODIFIED_WIN32_CUSTOM_NAMESPACE)); } if(resource.getModified() != null) { attributes.setModificationDate(resource.getModified().getTime()); } } } return attributes; } }
protected PathAttributes toAttributes(final StorageObject object) { final PathAttributes attributes = new PathAttributes(); if(StringUtils.isNotBlank(object.getMd5sum())) { // For manifest files, the ETag in the response for a GET or HEAD on the manifest file is the MD5 sum of // the concatenated string of ETags for each of the segments in the manifest. attributes.setChecksum(Checksum.parse(object.getMd5sum())); } attributes.setSize(object.getSize()); final String lastModified = object.getLastModified(); if(lastModified != null) { try { attributes.setModificationDate(iso8601DateParser.parse(lastModified).getTime()); } catch(InvalidDateException e) { log.warn(String.format("%s is not ISO 8601 format %s", lastModified, e.getMessage())); try { attributes.setModificationDate(rfc1123DateFormatter.parse(lastModified).getTime()); } catch(InvalidDateException f) { log.warn(String.format("%s is not RFC 1123 format %s", lastModified, f.getMessage())); } } } return attributes; }
protected PathAttributes toAttributes(final ObjectMetadata metadata) { final PathAttributes attributes = new PathAttributes(); attributes.setSize(Long.valueOf(metadata.getContentLength())); final String lastModified = metadata.getLastModified(); try { attributes.setModificationDate(rfc1123DateFormatter.parse(lastModified).getTime()); } catch(InvalidDateException e) { log.warn(String.format("%s is not RFC 1123 format %s", lastModified, e.getMessage())); } if(StringUtils.isNotBlank(metadata.getETag())) { final String etag = StringUtils.removePattern(metadata.getETag(), "\""); attributes.setETag(etag); if(metadata.getMetaData().containsKey(Constants.X_STATIC_LARGE_OBJECT)) { // For manifest files, the ETag in the response for a GET or HEAD on the manifest file is the MD5 sum of // the concatenated string of ETags for each of the segments in the manifest. attributes.setChecksum(Checksum.NONE); } else { attributes.setChecksum(Checksum.parse(etag)); } } return attributes; } }
final PathAttributes attributes = new PathAttributes(); try { attributes.setModificationDate(rfc1123.parse(headers.get(HttpHeaders.LAST_MODIFIED)).getTime());