From 5b50c26578f050bea3a13635b2662088b215e513 Mon Sep 17 00:00:00 2001 From: Baptiste Gaillard Date: Thu, 22 Mar 2018 08:08:42 +0100 Subject: [PATCH] Version 1.4.0. --- CHANGELOG.md | 4 ++ README.md | 2 +- pom.xml | 2 +- .../aws/s3/documentstore/S3DocumentStore.java | 1 + .../aws/s3/documentstore/S3UploadConfig.java | 52 +++++++++++++++++++ 5 files changed, 59 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8777f0..dc8f0c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [1.4.0] - 2018-03-22 + * Add `setCacheControl(...)` / `getCacheControl()` and `setContentType(...)` / `getContentType()` methods in the + `S3UploadConfig` class. + ## [1.3.0] - 2018-03-21 * Allow the `IDocumentStore` to accept an `IUploadConfig` file to pass additional configuration properties while uploading a file. diff --git a/README.md b/README.md index 00bfe1e..d057491 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Add the following dependency to you `pom.xml` file. org.gomoob aws-s3 - 1.2.0 + 1.4.0 ``` diff --git a/pom.xml b/pom.xml index 4868887..6e35224 100644 --- a/pom.xml +++ b/pom.xml @@ -36,7 +36,7 @@ 4.0.0 org.gomoob aws-s3 - 1.3.0 + 1.4.0 jar Gomoob Java Amazon Web Services S3 library The Gomoob Java Amazon Web Services S3 library contains utility class to work with the Amazon S3 Java SDK. diff --git a/src/main/java/com/gomoob/aws/s3/documentstore/S3DocumentStore.java b/src/main/java/com/gomoob/aws/s3/documentstore/S3DocumentStore.java index 612c8fa..da8818b 100644 --- a/src/main/java/com/gomoob/aws/s3/documentstore/S3DocumentStore.java +++ b/src/main/java/com/gomoob/aws/s3/documentstore/S3DocumentStore.java @@ -273,6 +273,7 @@ private IDocumentStoreFile uploadToS3(final RequestBody requestBody, final Strin // Puts the file on Amazon S3 PutObjectRequest putObjectRequest = PutObjectRequest.builder().bucket(this.bucket).key(prefixedKeyName) + .contentType(uploadConfig.getContentType()).cacheControl(uploadConfig.getCacheControl()) .metadata(uploadConfig.getMetadata()).build(); this.s3.putObject(putObjectRequest, requestBody); diff --git a/src/main/java/com/gomoob/aws/s3/documentstore/S3UploadConfig.java b/src/main/java/com/gomoob/aws/s3/documentstore/S3UploadConfig.java index 1ff7993..c10a9e1 100644 --- a/src/main/java/com/gomoob/aws/s3/documentstore/S3UploadConfig.java +++ b/src/main/java/com/gomoob/aws/s3/documentstore/S3UploadConfig.java @@ -36,11 +36,39 @@ */ public class S3UploadConfig implements IUploadConfig { + /** + * The Amazon S3 Cache-Control metadata to attach to the object to upload. + */ + private String cacheControl; + + /** + * The Amazon S3 Content-Type metadata to attache to the object to upload. + */ + private String contentType; + /** * The Amazon S3 metadata to attach to the object to upload. */ private Map metadata; + /** + * Gets the Amazon S3 Cache-Control metadata to attache to the object to upload. + * + * @return the Amazon S3 Cache-Control metadata to attache to the object to upload. + */ + public String getCacheControl() { + return this.cacheControl; + } + + /** + * Gets the Amazon S3 Content-Type metadata to attache to the object to upload. + * + * @return the Amazon S3 Content-Type metadata to attache to the object to upload. + */ + public String getContentType() { + return this.contentType; + } + /** * Gets the Amazon S3 metadata to attach to the object to upload. * @@ -50,6 +78,30 @@ public Map getMetadata() { return this.metadata; } + /** + * Sets the Amazon S3 Cache-Control metadata to attache to the object to upload. + * + * @param cacheControl the Amazon S3 Cache-Control metadata to attache to the object to upload. + * + * @return this instance. + */ + public S3UploadConfig setCacheControl(final String cacheControl) { + this.cacheControl = cacheControl; + return this; + } + + /** + * Sets the Amazon S3 Content-Type metadata to attache to the object to upload. + * + * @param contentType the Amazon S3 Content-Type metadata to attache to the object to upload. + * + * @return this instance. + */ + public S3UploadConfig setContentType(final String contentType) { + this.contentType = contentType; + return this; + } + /** * Sets the Amazon S3 metadata to attach to the object to upload. *