public class GeneratePresignedUrlRequest extends CosServiceRequest
| 构造器和说明 |
|---|
GeneratePresignedUrlRequest(String bucketName,
String key)
Creates a new request for generating a pre-signed URL that can be used as
part of an HTTP GET request to access the COS object stored under
the specified key in the specified bucket.
|
GeneratePresignedUrlRequest(String bucketName,
String key,
HttpMethodName method)
Creates a new request for generating a pre-signed URL that can be used as
part of an HTTP request to access the specified COS resource.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addRequestParameter(String key,
String value)
Adds an additional request parameter to be included in the pre-signed
URL.
|
String |
getBucketName()
Returns the name of the bucket involved in this request.
|
String |
getContentMd5()
Gets the expected content-md5 header of the request.
|
String |
getContentType()
Gets the expected content-type of the request.
|
Date |
getExpiration()
The expiration date at which point the new pre-signed URL will no longer
be accepted by COS.
|
String |
getKey()
Returns the key of the object involved in this request.
|
HttpMethodName |
getMethod()
The HTTP method (GET, PUT, DELETE, HEAD) to be used in this request.
|
Map<String,String> |
getRequestParameters()
Returns the complete map of additional request parameters to be included
in the pre-signed URL.
|
ResponseHeaderOverrides |
getResponseHeaders()
Returns the headers to be overridden in the service response.
|
String |
getVersionId()
Returns the version ID of the object, only present if versioning has
been enabled for the bucket.
|
boolean |
isSignPrefixMode() |
void |
rejectIllegalArguments()
Rejects any illegal input (as attributes of this request) by the user.
|
void |
setBucketName(String bucketName)
Sets the name of the bucket involved in this request.
|
void |
setContentMd5(String contentMd5)
Sets the expected content-md5 header of the request.
|
void |
setContentType(String contentType)
Sets the expected content-type of the request.
|
void |
setExpiration(Date expiration)
Sets the expiration date at which point the new pre-signed URL will no
longer be accepted by COS.
|
void |
setKey(String key)
Sets the key of the object involved in this request.
|
void |
setMethod(HttpMethodName method)
Sets the HTTP method (GET, PUT, DELETE, HEAD) to be used in this request.
|
void |
setResponseHeaders(ResponseHeaderOverrides responseHeaders)
Sets the headers to be overridden in the service response.
|
void |
setSignPrefixMode(boolean signPrefixMode) |
void |
setVersionId(String versionId)
Sets the version ID of the object, only present if versioning has
been enabled for the bucket.
|
GeneratePresignedUrlRequest |
withBucketName(String bucketName)
Sets the name of the bucket involved in this request, and returns this
request object to enable additional method calls to be chained together.
|
GeneratePresignedUrlRequest |
withContentMd5(String contentMd5)
Sets the expected content-md5 header of the request and returns this
object, for method chaining.
|
GeneratePresignedUrlRequest |
withContentType(String contentType)
Sets the expected content-type of the request and returns
this object, for method chaining.
|
GeneratePresignedUrlRequest |
withExpiration(Date expiration)
Sets the expiration date at which point the new pre-signed URL will no
longer be accepted by COS, and returns this request object to
enable additional method calls to be chained together.
|
GeneratePresignedUrlRequest |
withKey(String key)
Sets the key of the object involved in this request, and returns this
request object to enable additional method calls to be chained together.
|
GeneratePresignedUrlRequest |
withMethod(HttpMethodName method)
Sets the HTTP method (GET, PUT, DELETE, HEAD) to be used in this request,
and returns this request object to enable additional method calls to be
chained together.
|
GeneratePresignedUrlRequest |
withResponseHeaders(ResponseHeaderOverrides responseHeaders)
Sets the headers to be overridden in the service response and returns
this object, for method chaining.
|
GeneratePresignedUrlRequest |
withVersionId(String versionId)
Sets the version ID of the object, only present if versioning has
been enabled for the bucket.
|
clone, copyBaseTo, getCloneRoot, getCloneSource, getCosCredentials, getCustomQueryParameters, getCustomRequestHeaders, getFixedEndpointAddr, getGeneralProgressListener, getReadLimit, getRequestClientOptions, putCustomQueryParameter, putCustomRequestHeader, setCosCredentials, setFixedEndpointAddr, setGeneralProgressListener, withGeneralProgressListenerpublic GeneratePresignedUrlRequest(String bucketName, String key)
bucketName - The name of the bucket containing the desired COS
object.key - The key under which the desired COS object is stored.public GeneratePresignedUrlRequest(String bucketName, String key, HttpMethodName method)
Creates a new request for generating a pre-signed URL that can be used as part of an HTTP request to access the specified COS resource.
When specifying an HTTP method, you must send the pre-signed URL with the same HTTP method in order to successfully use the pre-signed URL.
bucketName - The name of the COS bucket involved in the operation.key - The key of the COS object involved in the operation.method - The HTTP method (GET, PUT, DELETE, HEAD) to be used in the
request when the pre-signed URL is used.public HttpMethodName getMethod()
public void setMethod(HttpMethodName method)
method - The HTTP method (GET, PUT, DELETE, HEAD) to be used in this
request.public GeneratePresignedUrlRequest withMethod(HttpMethodName method)
The same HTTP method must be used in the request when the pre-signed URL is used.
method - The HTTP method (GET, PUT, DELETE, HEAD) to be used in this
request.public String getBucketName()
public void setBucketName(String bucketName)
bucketName - the name of the bucket involved in this request.public GeneratePresignedUrlRequest withBucketName(String bucketName)
bucketName - the name of the bucket involved in this request.public String getKey()
public void setKey(String key)
key - the key of the object involved in this request.public GeneratePresignedUrlRequest withKey(String key)
key - the key of the object involved in this request.public String getVersionId()
public void setVersionId(String versionId)
versionId - The version ID of the object, only present if versioning
has been enabled for the bucket.public GeneratePresignedUrlRequest withVersionId(String versionId)
GeneratePresignedUrlRequest
object for method chanining.versionId - The version ID of the object, only present if versioning
has been enabled for the bucket.public Date getExpiration()
public void setExpiration(Date expiration)
expiration - The expiration date at which point the new pre-signed URL will
no longer be accepted by COS.public GeneratePresignedUrlRequest withExpiration(Date expiration)
If not specified, a default value will be supplied.
expiration - The expiration date at which point the new pre-signed URL will
no longer be accepted by COS.public void addRequestParameter(String key, String value)
key - The name of the request parameter, as it appears in the URL's
query string (e.g. versionId).value - The (optional) value of the request parameter being added.public Map<String,String> getRequestParameters()
public ResponseHeaderOverrides getResponseHeaders()
public void setResponseHeaders(ResponseHeaderOverrides responseHeaders)
responseHeaders - The headers to be overridden in the service response.public GeneratePresignedUrlRequest withResponseHeaders(ResponseHeaderOverrides responseHeaders)
responseHeaders - The headers to be overridden in the service response.GeneratePresignedUrlRequest for method chaining.public String getContentType()
public void setContentType(String contentType)
contentType - The expected content-typepublic GeneratePresignedUrlRequest withContentType(String contentType)
contentType - The expected content-typeGeneratePresignedUrlRequest for method chaining.public String getContentMd5()
public void setContentMd5(String contentMd5)
contentMd5 - The expected content-md5 header value.public GeneratePresignedUrlRequest withContentMd5(String contentMd5)
contentMd5 - The expected content-md5 header value.GeneratePresignedUrlRequest for method chaining.public void rejectIllegalArguments()
IllegalArgumentException - if there is illegal input from the user.public boolean isSignPrefixMode()
public void setSignPrefixMode(boolean signPrefixMode)
Copyright © 2021. All rights reserved.