@@ -184,29 +184,30 @@ public List<Bucket> listBuckets() {
184184
185185 public S3Object putObject (String bucketName , String key , byte [] data ,
186186 String contentType , Map <String , String > metadata ) {
187- return putObject (bucketName , key , data , contentType , metadata , null , null , null , null );
187+ return putObject (bucketName , key , data , contentType , metadata , null , null , null , null , null , null );
188188 }
189189
190190 public S3Object putObject (String bucketName , String key , byte [] data ,
191191 String contentType , Map <String , String > metadata ,
192192 String objectLockMode , Instant retainUntilDate , String legalHoldStatus ) {
193- return putObject (bucketName , key , data , contentType , metadata , null ,
194- objectLockMode , retainUntilDate , legalHoldStatus );
193+ return putObject (bucketName , key , data , contentType , metadata , null , null ,
194+ objectLockMode , retainUntilDate , legalHoldStatus , null );
195195 }
196196
197197 public S3Object putObject (String bucketName , String key , byte [] data ,
198198 String contentType , Map <String , String > metadata , String storageClass ,
199199 String objectLockMode , Instant retainUntilDate , String legalHoldStatus ) {
200200 return putObject (bucketName , key , data , contentType , metadata , storageClass , null ,
201- objectLockMode , retainUntilDate , legalHoldStatus );
201+ objectLockMode , retainUntilDate , legalHoldStatus , null );
202202 }
203203
204204 public S3Object putObject (String bucketName , String key , byte [] data ,
205205 String contentType , Map <String , String > metadata , String storageClass ,
206206 String contentEncoding ,
207- String objectLockMode , Instant retainUntilDate , String legalHoldStatus ) {
207+ String objectLockMode , Instant retainUntilDate , String legalHoldStatus ,
208+ String cacheControl ) {
208209 S3Object object = storeObject (bucketName , key , data , contentType , metadata , storageClass , null , null ,
209- objectLockMode , retainUntilDate , legalHoldStatus , contentEncoding );
210+ objectLockMode , retainUntilDate , legalHoldStatus , contentEncoding , cacheControl );
210211 fireNotifications (bucketName , key , "ObjectCreated:Put" , object );
211212 return object ;
212213 }
@@ -217,22 +218,22 @@ public S3Object putObject(String bucketName, String key, byte[] data,
217218 private S3Object storeObject (String bucketName , String key , byte [] data ,
218219 String contentType , Map <String , String > metadata ) {
219220 return storeObject (bucketName , key , data , contentType , metadata , null , null , null ,
220- null , null , null , null );
221+ null , null , null , null , null );
221222 }
222223
223224 private S3Object storeObject (String bucketName , String key , byte [] data ,
224225 String contentType , Map <String , String > metadata , String storageClass ,
225226 S3Checksum checksum , List <Part > parts ,
226227 String objectLockMode , Instant retainUntilDate , String legalHoldStatus ) {
227228 return storeObject (bucketName , key , data , contentType , metadata , storageClass , checksum , parts ,
228- objectLockMode , retainUntilDate , legalHoldStatus , null );
229+ objectLockMode , retainUntilDate , legalHoldStatus , null , null );
229230 }
230231
231232 private S3Object storeObject (String bucketName , String key , byte [] data ,
232233 String contentType , Map <String , String > metadata , String storageClass ,
233234 S3Checksum checksum , List <Part > parts ,
234235 String objectLockMode , Instant retainUntilDate , String legalHoldStatus ,
235- String contentEncoding ) {
236+ String contentEncoding , String cacheControl ) {
236237 Bucket bucket = bucketStore .get (bucketName )
237238 .orElseThrow (() -> new AwsException ("NoSuchBucket" ,
238239 "The specified bucket does not exist." , 404 ));
@@ -245,6 +246,7 @@ private S3Object storeObject(String bucketName, String key, byte[] data,
245246 object .setChecksum (checksum != null ? copyChecksum (checksum ) : buildChecksum (data , parts , false ));
246247 object .setParts (copyParts (parts ));
247248 object .setContentEncoding (contentEncoding );
249+ object .setCacheControl (cacheControl );
248250
249251 if (bucket .isVersioningEnabled ()) {
250252 String versionId = UUID .randomUUID ().toString ();
@@ -597,13 +599,14 @@ public S3Object copyObject(String sourceBucket, String sourceKey,
597599 String metadataDirective , Map <String , String > replacementMetadata ,
598600 String storageClass , String contentType ) {
599601 return copyObject (sourceBucket , sourceKey , destBucket , destKey , metadataDirective ,
600- replacementMetadata , storageClass , contentType , null );
602+ replacementMetadata , storageClass , contentType , null , null );
601603 }
602604
603605 public S3Object copyObject (String sourceBucket , String sourceKey ,
604606 String destBucket , String destKey ,
605607 String metadataDirective , Map <String , String > replacementMetadata ,
606- String storageClass , String contentType , String contentEncoding ) {
608+ String storageClass , String contentType , String contentEncoding ,
609+ String cacheControl ) {
607610 S3Object source = getObject (sourceBucket , sourceKey );
608611 ensureBucketExists (destBucket );
609612
@@ -616,9 +619,10 @@ public S3Object copyObject(String sourceBucket, String sourceKey,
616619 String effectiveContentType = replaceMetadata && contentType != null ? contentType : source .getContentType ();
617620 String effectiveStorageClass = storageClass != null ? storageClass : source .getStorageClass ();
618621 String effectiveContentEncoding = replaceMetadata && contentEncoding != null ? contentEncoding : source .getContentEncoding ();
622+ String effectiveCacheControl = replaceMetadata && cacheControl != null ? cacheControl : source .getCacheControl ();
619623 S3Object copy = storeObject (destBucket , destKey , source .getData (), effectiveContentType , metadata ,
620624 effectiveStorageClass , source .getChecksum (), source .getParts (), null , null , null ,
621- effectiveContentEncoding );
625+ effectiveContentEncoding , effectiveCacheControl );
622626 copy .setETag (source .getETag ());
623627 LOG .debugv ("Copied object: {0}/{1} -> {2}/{3}" , sourceBucket , sourceKey , destBucket , destKey );
624628 fireNotifications (destBucket , destKey , "ObjectCreated:Copy" , copy );
@@ -1560,6 +1564,7 @@ private static S3Object copyObject(S3Object source) {
15601564 copy .setMetadata (new HashMap <>(source .getMetadata ()));
15611565 copy .setContentType (source .getContentType ());
15621566 copy .setContentEncoding (source .getContentEncoding ());
1567+ copy .setCacheControl (source .getCacheControl ());
15631568 copy .setSize (source .getSize ());
15641569 copy .setLastModified (source .getLastModified ());
15651570 copy .setETag (source .getETag ());
0 commit comments