FileUtil.deleteFile(filePayload);
}
}
private ObjectMetadata determineMetadata(final Exchange exchange) {
ObjectMetadata objectMetadata = new ObjectMetadata();
Long contentLength = exchange.getIn().getHeader(S3Constants.CONTENT_LENGTH, Long.class);
if (contentLength != null) {
objectMetadata.setContentLength(contentLength);
}
String contentType = exchange.getIn().getHeader(S3Constants.CONTENT_TYPE, String.class);
if (contentType != null) {
objectMetadata.setContentType(contentType);
}
String cacheControl = exchange.getIn().getHeader(S3Constants.CACHE_CONTROL, String.class);
if (cacheControl != null) {
objectMetadata.setCacheControl(cacheControl);
}
String contentDisposition = exchange.getIn().getHeader(S3Constants.CONTENT_DISPOSITION, String.class);
if (contentDisposition != null) {
objectMetadata.setContentDisposition(contentDisposition);
}
String contentEncoding = exchange.getIn().getHeader(S3Constants.CONTENT_ENCODING, String.class);
if (contentEncoding != null) {
objectMetadata.setContentEncoding(contentEncoding);
}
String contentMD5 = exchange.getIn().getHeader(S3Constants.CONTENT_MD5, String.class);
if (contentMD5 != null) {
objectMetadata.setContentMD5(contentMD5);
}
Date lastModified = exchange.getIn().getHeader(S3Constants.LAST_MODIFIED, Date.class);
if (lastModified != null) {
objectMetadata.setLastModified(lastModified);
}
Map<String, String> userMetadata = CastUtils.cast(exchange.getIn().getHeader(S3Constants.USER_METADATA, Map.class));
if (userMetadata != null) {
objectMetadata.setUserMetadata(userMetadata);
}
return objectMetadata;
}