public interface RequestSpec
Modifier and Type | Interface and Description |
---|---|
static interface |
RequestSpec.Body
The request body.
|
Modifier and Type | Method and Description |
---|---|
default RequestSpec |
basicAuth(String username,
String password)
Adds the appropriate header for HTTP Basic authentication with the given username and password.
|
RequestSpec |
body(Action<? super RequestSpec.Body> action)
Executes the given action with the
request body . |
RequestSpec |
decompressResponse(boolean shouldDecompress)
Enables automatic decompression of the response.
|
RequestSpec.Body |
getBody()
The body of the request, used for specifying the body content.
|
MutableHeaders |
getHeaders() |
URI |
getUrl() |
RequestSpec |
headers(Action<? super MutableHeaders> action)
This method can be used to compose changes to the headers.
|
RequestSpec |
method(String method)
Set the HTTP verb to use.
|
RequestSpec |
readTimeout(Duration duration) |
default RequestSpec |
readTimeoutSeconds(int seconds) |
RequestSpec |
redirects(int maxRedirects) |
default RequestSpec |
sslContext(Factory<SSLContext> factory)
Factory method to create
SSLContext used for client and server SSL authentication. |
RequestSpec |
sslContext(SSLContext sslContext)
Sets the
SSLContext used for client and server SSL authentication. |
RequestSpec redirects(int maxRedirects)
maxRedirects
- Sets the maximum number of redirects to followRequestSpec sslContext(SSLContext sslContext)
SSLContext
used for client and server SSL authentication.sslContext
- SSL context with keystore as well as trust storeRequestSpec
default RequestSpec sslContext(Factory<SSLContext> factory) throws Exception
SSLContext
used for client and server SSL authentication.factory
- provides a factory that will create SSLContext
instanceRequestSpec
Exception
- this can be thrown from the actionMutableHeaders getHeaders()
MutableHeaders
that can be used to configure the headers that will be used for the request.RequestSpec headers(Action<? super MutableHeaders> action) throws Exception
action
- Provide an action that will act on MutableHeaders.Exception
- This can be thrown from the action supplied.RequestSpec method(String method)
method
- which HTTP verb to useRequestSpec decompressResponse(boolean shouldDecompress)
shouldDecompress
- whether to enable decompressionURI getUrl()
default RequestSpec readTimeoutSeconds(int seconds)
RequestSpec readTimeout(Duration duration)
RequestSpec.Body getBody()
RequestSpec body(Action<? super RequestSpec.Body> action) throws Exception
request body
.
This method is a “fluent API” alternative to getBody()
.
action
- configuration of the request bodyException
- any thrown by action
default RequestSpec basicAuth(String username, String password)
This will replace any previous value set for the "Authorization"
header.
username
- the usernamepassword
- the passwordthis