Example usage for com.amazonaws.services.s3.model GeneratePresignedUrlRequest GeneratePresignedUrlRequest

List of usage examples for com.amazonaws.services.s3.model GeneratePresignedUrlRequest GeneratePresignedUrlRequest

Introduction

In this page you can find the example usage for com.amazonaws.services.s3.model GeneratePresignedUrlRequest GeneratePresignedUrlRequest.

Prototype

public GeneratePresignedUrlRequest(String bucketName, String key, HttpMethod method) 

Source Link

Document

<p> Creates a new request for generating a pre-signed URL that can be used as part of an HTTP request to access the specified Amazon S3 resource.

Usage

From source file:org.whispersystems.textsecuregcm.s3.UrlSigner.java

License:Open Source License

public URL getPreSignedUrl(long attachmentId, HttpMethod method) {
    AmazonS3 client = new AmazonS3Client(credentials);
    GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, String.valueOf(attachmentId),
            method);/*from  ww w.j a  va  2  s.  c om*/

    request.setExpiration(new Date(System.currentTimeMillis() + DURATION));
    request.setContentType("application/octet-stream");

    client.setS3ClientOptions(S3ClientOptions.builder().setAccelerateModeEnabled(true).build());

    return client.generatePresignedUrl(request);
}

From source file:org.whispersystems.textsecuregcm.util.UrlSigner.java

License:Open Source License

public URL getPreSignedUrl(long attachmentId, HttpMethod method) {
    AmazonS3 client = new AmazonS3Client(credentials);
    GeneratePresignedUrlRequest request = new GeneratePresignedUrlRequest(bucket, String.valueOf(attachmentId),
            method);/*from  w  w  w  .  j ava2  s .co  m*/

    request.setExpiration(new Date(System.currentTimeMillis() + DURATION));
    request.setContentType("application/octet-stream");

    return client.generatePresignedUrl(request);
}