List of usage examples for com.amazonaws.services.s3 Headers CONTENT_ENCODING
String CONTENT_ENCODING
To view the source code for com.amazonaws.services.s3 Headers CONTENT_ENCODING.
Click Source Link
From source file:org.duracloud.s3storage.S3StorageProvider.java
License:Apache License
private Map<String, String> prepContentProperties(ObjectMetadata objMetadata) { Map<String, String> contentProperties = new HashMap<>(); // Set the user properties Map<String, String> userProperties = objMetadata.getUserMetadata(); for (String metaName : userProperties.keySet()) { String metaValue = userProperties.get(metaName); contentProperties.put(getWithSpace(decodeHeaderKey(metaName)), decodeHeaderValue(metaValue)); }//from w w w .ja v a2 s .c om // Set the response metadata Map<String, Object> responseMeta = objMetadata.getRawMetadata(); for (String metaName : responseMeta.keySet()) { Object metaValue = responseMeta.get(metaName); if (metaValue instanceof String) { contentProperties.put(metaName, (String) metaValue); } } // Set MIMETYPE String contentType = objMetadata.getContentType(); if (contentType != null) { contentProperties.put(PROPERTIES_CONTENT_MIMETYPE, contentType); contentProperties.put(Headers.CONTENT_TYPE, contentType); } // Set CONTENT_ENCODING String encoding = objMetadata.getContentEncoding(); if (encoding != null) { contentProperties.put(Headers.CONTENT_ENCODING, encoding); } // Set SIZE long contentLength = objMetadata.getContentLength(); if (contentLength >= 0) { String size = String.valueOf(contentLength); contentProperties.put(PROPERTIES_CONTENT_SIZE, size); contentProperties.put(Headers.CONTENT_LENGTH, size); } // Set CHECKSUM String checksum = objMetadata.getETag(); if (checksum != null) { String eTagValue = getETagValue(checksum); contentProperties.put(PROPERTIES_CONTENT_CHECKSUM, eTagValue); contentProperties.put(PROPERTIES_CONTENT_MD5, eTagValue); contentProperties.put(Headers.ETAG, eTagValue); } // Set MODIFIED Date modified = objMetadata.getLastModified(); if (modified != null) { String modDate = formattedDate(modified); contentProperties.put(PROPERTIES_CONTENT_MODIFIED, modDate); contentProperties.put(Headers.LAST_MODIFIED, modDate); } return contentProperties; }