camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmuel...@apache.org
Subject svn commit: r1176058 - /camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
Date Mon, 26 Sep 2011 21:05:33 GMT
Author: cmueller
Date: Mon Sep 26 21:05:32 2011
New Revision: 1176058

URL: http://svn.apache.org/viewvc?rev=1176058&view=rev
Log:
CAMEL-4268: Add support for adding CacheControl and ContentDisposition metadata support when
uploading file

Modified:
    camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java

Modified: camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java?rev=1176058&r1=1176057&r2=1176058&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
(original)
+++ camel/branches/camel-2.8.x/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
Mon Sep 26 21:05:32 2011
@@ -17,6 +17,7 @@
 package org.apache.camel.component.aws.s3;
 
 import java.io.InputStream;
+import java.util.Date;
 
 import com.amazonaws.services.s3.model.ObjectMetadata;
 import com.amazonaws.services.s3.model.PutObjectRequest;
@@ -55,6 +56,31 @@ public class S3Producer extends DefaultP
             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);
+        }
+        
         PutObjectRequest putObjectRequest = new PutObjectRequest(
                 getConfiguration().getBucketName(),
                 determineKey(exchange),



Mime
View raw message