diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequest.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequest.java index 4ca1619e25..f880353cb3 100644 --- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequest.java +++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/binders/BindObjectMetadataToRequest.java @@ -65,6 +65,12 @@ public class BindObjectMetadataToRequest implements Binder { if (md.getContentMetadata().getContentEncoding() != null) { headers.put("Content-Encoding", md.getContentMetadata().getContentEncoding()); } + + String contentLanguage = md.getContentMetadata().getContentLanguage(); + if (contentLanguage != null) { + headers.put(HttpHeaders.CONTENT_LANGUAGE, contentLanguage); + } + if (md.getContentMetadata().getContentType() != null) { headers.put(HttpHeaders.CONTENT_TYPE, md.getContentMetadata().getContentType()); } else { diff --git a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/SequentialMultipartUploadStrategy.java b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/SequentialMultipartUploadStrategy.java index 2f9623ea7a..9c15b4ef2b 100644 --- a/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/SequentialMultipartUploadStrategy.java +++ b/providers/aws-s3/src/main/java/org/jclouds/aws/s3/blobstore/strategy/internal/SequentialMultipartUploadStrategy.java @@ -81,19 +81,16 @@ public class SequentialMultipartUploadStrategy implements MultipartUploadStrateg if (partCount > 0) { ObjectMetadataBuilder builder = ObjectMetadataBuilder.create().key(key) .contentType(metadata.getContentType()) - .contentDisposition(metadata.getContentDisposition()); + .contentDisposition(metadata.getContentDisposition()) + .contentEncoding(metadata.getContentEncoding()) + .contentLanguage(metadata.getContentLanguage()) + .userMetadata(blob.getMetadata().getUserMetadata()); String uploadId = client.initiateMultipartUpload(container, builder.build()); try { SortedMap etags = Maps.newTreeMap(); - int part; - while ((part = algorithm.getNextPart()) <= partCount) { - prepareUploadPart(container, key, uploadId, part, payload, algorithm.getNextChunkOffset(), chunkSize, - etags); - } - long remaining = algorithm.getRemaining(); - if (remaining > 0) { - prepareUploadPart(container, key, uploadId, part, payload, algorithm.getNextChunkOffset(), remaining, - etags); + for (Payload part : slicer.slice(payload, chunkSize)) { + int partNum = algorithm.getNextPart(); + prepareUploadPart(container, key, uploadId, partNum, part, algorithm.getNextChunkOffset(), etags); } return client.completeMultipartUpload(container, key, uploadId, etags); } catch (RuntimeException ex) { @@ -107,9 +104,8 @@ public class SequentialMultipartUploadStrategy implements MultipartUploadStrateg } } - private void prepareUploadPart(String container, String key, String uploadId, int part, Payload payload, - long offset, long size, SortedMap etags) { - Payload chunkedPart = slicer.slice(payload, offset, size); + private void prepareUploadPart(String container, String key, String uploadId, int part, Payload chunkedPart, + long offset, SortedMap etags) { String eTag = null; try { eTag = client.uploadPart(container, key, part, uploadId, chunkedPart);