Skip to content

Commit

Permalink
Version 1.4.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgaillard committed Mar 22, 2018
1 parent 3aedbbe commit 5b50c26
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Add the following dependency to you `pom.xml` file.
<dependency>
<groupId>org.gomoob</groupId>
<artifactId>aws-s3</artifactId>
<version>1.2.0</version>
<version>1.4.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gomoob</groupId>
<artifactId>aws-s3</artifactId>
<version>1.3.0</version>
<version>1.4.0</version>
<packaging>jar</packaging>
<name>Gomoob Java Amazon Web Services S3 library</name>
<description>The Gomoob Java Amazon Web Services S3 library contains utility class to work with the Amazon S3 Java SDK.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
52 changes: 52 additions & 0 deletions src/main/java/com/gomoob/aws/s3/documentstore/S3UploadConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,39 @@
*/
public class S3UploadConfig implements IUploadConfig {

/**
* The Amazon S3 <tt>Cache-Control</tt> metadata to attach to the object to upload.
*/
private String cacheControl;

/**
* The Amazon S3 <tt>Content-Type</tt> metadata to attache to the object to upload.
*/
private String contentType;

/**
* The Amazon S3 metadata to attach to the object to upload.
*/
private Map<String, String> metadata;

/**
* Gets the Amazon S3 <tt>Cache-Control</tt> metadata to attache to the object to upload.
*
* @return the Amazon S3 <tt>Cache-Control</tt> metadata to attache to the object to upload.
*/
public String getCacheControl() {
return this.cacheControl;
}

/**
* Gets the Amazon S3 <tt>Content-Type</tt> metadata to attache to the object to upload.
*
* @return the Amazon S3 <tt>Content-Type</tt> 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.
*
Expand All @@ -50,6 +78,30 @@ public Map<String, String> getMetadata() {
return this.metadata;
}

/**
* Sets the Amazon S3 <tt>Cache-Control</tt> metadata to attache to the object to upload.
*
* @param cacheControl the Amazon S3 <tt>Cache-Control</tt> 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 <tt>Content-Type</tt> metadata to attache to the object to upload.
*
* @param contentType the Amazon S3 <tt>Content-Type</tt> 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.
*
Expand Down

0 comments on commit 5b50c26

Please sign in to comment.