B
- The request body typepublic interface MutableHttpRequest<B> extends HttpRequest<B>, MutableHttpMessage<B>
HttpRequest
that allows mutating headers, the body etc.SCHEME_HTTP, SCHEME_HTTPS
Modifier and Type | Method and Description |
---|---|
default MutableHttpRequest<B> |
accept(CharSequence... mediaTypes)
Sets the acceptable
MediaType instances via the HttpHeaders.ACCEPT header. |
default MutableHttpRequest<B> |
accept(MediaType... mediaTypes)
Sets the acceptable
MediaType instances via the HttpHeaders.ACCEPT header. |
default MutableHttpRequest<B> |
basicAuth(CharSequence username,
CharSequence password)
Set an
HttpHeaders.AUTHORIZATION header, with value: "Basic Base64(username:password)". |
default MutableHttpRequest<B> |
bearerAuth(CharSequence token)
Set an
HttpHeaders.AUTHORIZATION header, with value: "Bearer token". |
<T> MutableHttpRequest<T> |
body(T body)
Sets the body.
|
default MutableHttpRequest<B> |
contentEncoding(CharSequence encoding)
Sets the content encoding.
|
default MutableHttpRequest<B> |
contentLength(long length)
Sets the content length.
|
default MutableHttpRequest<B> |
contentType(CharSequence contentType)
Set the response content type.
|
default MutableHttpRequest<B> |
contentType(MediaType mediaType)
Set the response content type.
|
MutableHttpRequest<B> |
cookie(Cookie cookie)
Sets the specified cookie on the request.
|
default MutableHttpRequest<B> |
cookies(Set<Cookie> cookies)
Sets the specified cookies on the request.
|
MutableHttpHeaders |
getHeaders() |
MutableHttpParameters |
getParameters() |
default MutableHttpRequest<B> |
header(CharSequence name,
CharSequence value)
Set a response header.
|
default MutableHttpRequest<B> |
headers(Consumer<MutableHttpHeaders> headers)
Mutate the headers with the given consumer.
|
default MutableHttpRequest<B> |
headers(Map<CharSequence,CharSequence> namesAndValues)
Set multiple headers.
|
default MutableHttpRequest<B> |
uri(Consumer<UriBuilder> consumer)
Alters the URI of the request with the given URI builder.
|
MutableHttpRequest<B> |
uri(URI uri)
Sets the uri on the request.
|
accept, create, create, DELETE, DELETE, DELETE, DELETE, GET, GET, getCertificate, getCookies, getHttpVersion, getLocale, getMethod, getMethodName, getPath, getRemoteAddress, getServerAddress, getServerName, getUri, getUserPrincipal, getUserPrincipal, HEAD, HEAD, isSecure, mutate, OPTIONS, OPTIONS, PATCH, PATCH, POST, POST, PUT, PUT, setAttribute
getAttributes, getBody, getBody, getBody, getCharacterEncoding, getContentLength, getContentType
removeAttribute
getAttribute, getAttribute
MutableHttpRequest<B> cookie(Cookie cookie)
cookie
- the Cookie to return to the clientdefault MutableHttpRequest<B> cookies(Set<Cookie> cookies)
cookies
- the Cookies to return to the clientMutableHttpRequest<B> uri(URI uri)
uri
- The uri to call<T> MutableHttpRequest<T> body(T body)
MutableHttpMessage
body
in interface MutableHttpMessage<B>
T
- The new body typebody
- The bodyMutableHttpHeaders getHeaders()
getHeaders
in interface HttpMessage<B>
getHeaders
in interface MutableHttpMessage<B>
HttpHeaders
objectMutableHttpParameters getParameters()
getParameters
in interface HttpRequest<B>
@NonNull default MutableHttpRequest<B> uri(@NonNull Consumer<UriBuilder> consumer)
consumer
- A consumer that accepts the URIdefault MutableHttpRequest<B> accept(MediaType... mediaTypes)
MediaType
instances via the HttpHeaders.ACCEPT
header.mediaTypes
- The media typesdefault MutableHttpRequest<B> accept(CharSequence... mediaTypes)
MediaType
instances via the HttpHeaders.ACCEPT
header.mediaTypes
- The media typesdefault MutableHttpRequest<B> headers(Consumer<MutableHttpHeaders> headers)
MutableHttpMessage
headers
in interface MutableHttpMessage<B>
headers
- The headersdefault MutableHttpRequest<B> header(CharSequence name, CharSequence value)
MutableHttpMessage
header
in interface MutableHttpMessage<B>
name
- The name of the headervalue
- The value of the headerdefault MutableHttpRequest<B> basicAuth(CharSequence username, CharSequence password)
MutableHttpMessage
HttpHeaders.AUTHORIZATION
header, with value: "Basic Base64(username:password)".basicAuth
in interface MutableHttpMessage<B>
username
- The username part of the credentialspassword
- The password part of the credentialsdefault MutableHttpRequest<B> bearerAuth(CharSequence token)
MutableHttpMessage
HttpHeaders.AUTHORIZATION
header, with value: "Bearer token".bearerAuth
in interface MutableHttpMessage<B>
token
- The tokendefault MutableHttpRequest<B> headers(Map<CharSequence,CharSequence> namesAndValues)
MutableHttpMessage
headers
in interface MutableHttpMessage<B>
namesAndValues
- The names and valuesdefault MutableHttpRequest<B> contentLength(long length)
MutableHttpMessage
contentLength
in interface MutableHttpMessage<B>
length
- The lengthdefault MutableHttpRequest<B> contentType(CharSequence contentType)
MutableHttpMessage
contentType
in interface MutableHttpMessage<B>
contentType
- The content typedefault MutableHttpRequest<B> contentType(MediaType mediaType)
MutableHttpMessage
contentType
in interface MutableHttpMessage<B>
mediaType
- The media typedefault MutableHttpRequest<B> contentEncoding(CharSequence encoding)
MutableHttpMessage
contentEncoding
in interface MutableHttpMessage<B>
encoding
- The encoding to use