public static class Request.RequestBuilder extends Object implements org.apache.commons.lang3.builder.Builder<Request>
Request.builder().| Constructor and Description |
|---|
RequestBuilder() |
| Modifier and Type | Method and Description |
|---|---|
Request.RequestBuilder |
body(byte[] requestBody)
Sets a content of HTTP request body.
|
Request |
build()
Returns a newly-created immutable HTTP request.
|
Request.RequestBuilder |
header(String headerName,
String value)
Adds a single header for an HTTP request.
|
Request.RequestBuilder |
headers(Map<String,String> headers)
Sets headers of HTTP request.
|
Request.RequestBuilder |
method(String method)
Sets HTTP method: GET, PUT, POST, DELETE.
|
Request.RequestBuilder |
uri(String uri)
Sets the URI of the HTTP request.
|
Request.RequestBuilder |
uri(URI uri)
Sets the URI of the HTTP request.
|
public Request.RequestBuilder body(byte[] requestBody)
requestBody - a request body, in bytespublic Request.RequestBuilder header(String headerName, String value)
Adds a single header for an HTTP request. This can be called multiple times to add as many headers as needed.
NOTE: All header names are lower-cased for storage. In HTTP, header names are case-insensitive anyway, and EdgeGrid does not support multiple headers with the same name. Forcing to lowercase here improves our chance of detecting bad requests early.
headerName - a header namevalue - a header valueIllegalArgumentException - if a duplicate header name is encounteredpublic Request.RequestBuilder headers(Map<String,String> headers)
Sets headers of HTTP request. The headers parameter is copied so that changes
to the original Map will not impact the stored reference.
NOTE: All header names are lower-cased for storage. In HTTP, header names are case-insensitive anyway, and EdgeGrid does not support multiple headers with the same name. Forcing to lowercase here improves our chance of detecting bad requests early.
headers - a Map of headersIllegalArgumentException - if a duplicate header name is encounteredpublic Request.RequestBuilder method(String method)
method - an HTTP methodpublic Request.RequestBuilder uri(String uri)
Sets the URI of the HTTP request. This URI MUST have the correct path and query
segments set. Scheme is assumed to be "HTTPS" for the purpose of this library. Host is
actually taken from a ClientCredential as signing time; any value in this URI is
discarded. Fragments are not signed.
A path and/or query string is required.
uri - a URIpublic Request.RequestBuilder uri(URI uri)
Sets the URI of the HTTP request. This URI MUST have the correct path and query
segments set. Scheme is assumed to be "HTTPS" for the purpose of this library. Host is
actually taken from a ClientCredential as signing time; any value in this URI is
discarded. Fragments are not signed.
A path and/or query string is required.
uri - a URICopyright © 2016–2018. All rights reserved.