public final class Request extends Object
Modifier and Type | Method and Description |
---|---|
Request |
attribute(String name,
String value) |
Request |
attributePrefix(String attributePrefix) |
Request |
connectTimeout(long duration,
TimeUnit unit) |
void |
execute() |
boolean |
exists()
Returns true if and only if status code is 2xx.
|
Request |
header(String name,
String value) |
Request |
metadata(String key,
String value)
Adds the header
x-amz-meta-KEY:value . |
Request |
method(HttpMethod method) |
String |
presignedUrl(long expiryDuration,
TimeUnit unit) |
Request |
query(String name) |
Request |
query(String name,
String value) |
Request |
readTimeout(long duration,
TimeUnit unit) |
Request |
region(String region) |
Request |
requestBody(byte[] requestBody) |
Request |
requestBody(String requestBody) |
Response |
response()
Opens a connection and makes the request.
|
byte[] |
responseAsBytes() |
String |
responseAsUtf8() |
XmlElement |
responseAsXml() |
Response |
responseExpectStatusCode(int expectedStatusCode)
Opens a connection and makes the request.
|
ResponseInputStream |
responseInputStream()
Opens a connection and makes the request.
|
Request |
retryBackoffFactor(double factor) |
Request |
retryInitialInterval(long duration,
TimeUnit unit) |
Request |
retryJitter(double jitter)
Sets the level of randomness applied to the next retry interval.
|
Request |
retryMaxAttempts(int maxAttempts) |
Request |
retryMaxInterval(long duration,
TimeUnit unit) |
Request |
signPayload(boolean signPayload) |
Request |
unsignedPayload() |
public Request method(HttpMethod method)
public Request signPayload(boolean signPayload)
public Request unsignedPayload()
public Request metadata(String key, String value)
x-amz-meta-KEY:value
. KEY
is obtained from
key
by converting to lower-case (headers are case-insensitive) and
only retaining alphabetical and digit characters.key
- metadata keyvalue
- metadata valuepublic Request requestBody(byte[] requestBody)
public Request retryMaxAttempts(int maxAttempts)
public Request retryJitter(double jitter)
(1 - jitter * Math.random())
. A value of zero means no jitter, 1
means max jitter.jitter
- level of randomness applied to the retry intervalpublic Request retryBackoffFactor(double factor)
public ResponseInputStream responseInputStream()
public Response response()
public Response responseExpectStatusCode(int expectedStatusCode)
ServiceException
is thrown.ServiceException
public byte[] responseAsBytes()
public boolean exists()
ServiceException
otherwise.ServiceException
- if status code other than 2xx or 404public void execute()
public String responseAsUtf8()
public XmlElement responseAsXml()
Copyright © 2021–2024. All rights reserved.