public class PresignedUrlUploadRequest extends AmazonWebServiceRequest implements S3DataSource, Serializable
PutObjectRequest
. Depending on whether a file or input stream is being uploaded,
this request has slightly different behavior.
When uploading a file:
setMetadata(ObjectMetadata)
or
AmazonWebServiceRequest.putCustomRequestHeader(String, String)
Amazon S3 is a distributed system. If Amazon S3 receives multiple write requests for the same object nearly simultaneously, all of the objects might be stored. However, only one object will obtain the key.
If custom headers are used in generating the url, you can set them throughAmazonWebServiceRequest.putCustomRequestHeader(String, String)
method. If any signed headers or parameters are missing from the request, a Signature mismatch error will be thrown from S3.
Ensure you set all the custom headers/parameters that are used for creating the presigned url.S3DataSource.Utils
NOOP
Constructor and Description |
---|
PresignedUrlUploadRequest(URL presignedUrl) |
Modifier and Type | Method and Description |
---|---|
File |
getFile() |
HttpMethodName |
getHttpMethodName() |
InputStream |
getInputStream() |
ObjectMetadata |
getMetadata()
Gets the optional metadata instructing Amazon S3 how to handle the
uploaded data (e.g.
|
URL |
getPresignedUrl() |
void |
setFile(File file) |
void |
setHttpMethodName(HttpMethodName httpMethodName) |
void |
setInputStream(InputStream inputStream) |
void |
setMetadata(ObjectMetadata metadata)
Sets the optional metadata instructing Amazon S3 how to handle the
uploaded data (e.g.
|
void |
setPresignedUrl(URL presignedUrl) |
PresignedUrlUploadRequest |
withFile(File file) |
PresignedUrlUploadRequest |
withHttpMethodName(HttpMethodName httpMethodName) |
PresignedUrlUploadRequest |
withInputStream(InputStream inputStream) |
PresignedUrlUploadRequest |
withMetadata(ObjectMetadata metadata)
Sets the optional metadata instructing Amazon S3 how to handle the
uploaded data (e.g.
|
PresignedUrlUploadRequest |
withPresignedUrl(URL presignedUrl) |
addHandlerContext, clone, copyBaseTo, getCloneRoot, getCloneSource, getCustomQueryParameters, getCustomRequestHeaders, getGeneralProgressListener, getHandlerContext, getReadLimit, getRequestClientOptions, getRequestCredentials, getRequestCredentialsProvider, getRequestMetricCollector, getSdkClientExecutionTimeout, getSdkRequestTimeout, putCustomQueryParameter, putCustomRequestHeader, setGeneralProgressListener, setRequestCredentials, setRequestCredentialsProvider, setRequestMetricCollector, setSdkClientExecutionTimeout, setSdkRequestTimeout, withGeneralProgressListener, withRequestCredentialsProvider, withRequestMetricCollector, withSdkClientExecutionTimeout, withSdkRequestTimeout
public PresignedUrlUploadRequest(URL presignedUrl)
public URL getPresignedUrl()
public void setPresignedUrl(URL presignedUrl)
presignedUrl
- sets the presigned url to send the request topublic PresignedUrlUploadRequest withPresignedUrl(URL presignedUrl)
presignedUrl
- sets the presigned url to send the request topublic HttpMethodName getHttpMethodName()
public void setHttpMethodName(HttpMethodName httpMethodName)
httpMethodName
- Sets the HTTP method (PUT, POST) to be used in this request. The default value is PUT.public PresignedUrlUploadRequest withHttpMethodName(HttpMethodName httpMethodName)
httpMethodName
- Sets the HTTP method (PUT, POST) to be used in this request. The default value is PUT.public File getFile()
getFile
in interface S3DataSource
public void setFile(File file)
setFile
in interface S3DataSource
file
- Sets the file to uploadpublic PresignedUrlUploadRequest withFile(File file)
file
- Sets the file to uploadpublic InputStream getInputStream()
getInputStream
in interface S3DataSource
public void setInputStream(InputStream inputStream)
setInputStream
in interface S3DataSource
inputStream
- the data stream to uploadpublic PresignedUrlUploadRequest withInputStream(InputStream inputStream)
inputStream
- the data stream to uploadpublic ObjectMetadata getMetadata()
If uploading from an input stream, always specify metadata with the content size set. Otherwise the contents of the input stream have to be buffered in memory before being sent to Amazon S3. This can cause very negative performance impacts.
public void setMetadata(ObjectMetadata metadata)
If uploading from an input stream, always specify metadata with the content size set. Otherwise the contents of the input stream have to be buffered in memory before being sent to Amazon S3. This can cause very negative performance impacts.
metadata
- The optional metadata instructing Amazon S3 how to handle the
uploaded data (e.g. custom user metadata, hooks for specifying
content type, etc.).public PresignedUrlUploadRequest withMetadata(ObjectMetadata metadata)
If uploading from an input stream, always specify metadata with the content size set. Otherwise the contents of the input stream have to be buffered in memory before being sent to Amazon S3. This can cause very negative performance impacts.
metadata
- The optional metadata instructing Amazon S3 how to handle the
uploaded data (e.g. custom user metadata, hooks for specifying
content type, etc.).Copyright © 2022. All rights reserved.