Class Request.RequestBuilder
- Enclosing class:
Request
Request.builder()
. The returned builder is equivalent to the builder
generated by Request.builder()
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbody
(byte[] requestBody) Sets a content of HTTP request body.build()
Returns a newly-created immutable HTTP request.Adds a single header for an HTTP request.Sets headers of HTTP request.Sets HTTP method: GET, PUT, POST, DELETE.Sets the URI of the HTTP request.Sets the URI of the HTTP request.
-
Constructor Details
-
RequestBuilder
public RequestBuilder()
-
-
Method Details
-
body
Sets a content of HTTP request body. If not set, body is empty by default.- Parameters:
requestBody
- a request body, in bytes- Returns:
- reference back to this builder instance
-
header
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.
- Parameters:
headerName
- a header namevalue
- a header value- Returns:
- reference back to this builder instance
- Throws:
IllegalArgumentException
- if a duplicate header name is encountered
-
headers
Sets headers of HTTP request. The
headers
parameter is copied so that changes to the originalMap
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.
- Parameters:
headers
- aMap
of headers- Returns:
- reference back to this builder instance
- Throws:
IllegalArgumentException
- if a duplicate header name is encountered
-
method
Sets HTTP method: GET, PUT, POST, DELETE. Mandatory to set.- Parameters:
method
- an HTTP method- Returns:
- reference back to this builder instance
-
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.
- Parameters:
uri
- aURI
- Returns:
- reference back to this builder instance
-
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.
- Parameters:
uri
- aURI
- Returns:
- reference back to this builder instance
-
build
Returns a newly-created immutable HTTP request.- Returns:
- new HTTP request
Request
-