B
- The request body typepublic interface MutableHttpRequest<B> extends HttpRequest<B>, MutableHttpMessage<B>
HttpRequest
that allows mutating headers, the body etc.Modifier and Type | Method and Description |
---|---|
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". |
MutableHttpRequest<B> |
body(B 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.
|
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.
|
MutableHttpRequest<B> |
uri(URI uri)
Sets the uri on the request.
|
create, DELETE, DELETE, DELETE, GET, GET, getCookies, getLocale, getMethod, getPath, getRemoteAddress, getServerAddress, getServerName, getUri, getUserPrincipal, getUserPrincipal, HEAD, HEAD, isSecure, 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 clientMutableHttpRequest<B> uri(URI uri)
uri
- The uri to callMutableHttpRequest<B> body(B body)
MutableHttpMessage
body
in interface MutableHttpMessage<B>
body
- The bodyMutableHttpHeaders getHeaders()
getHeaders
in interface HttpMessage<B>
getHeaders
in interface MutableHttpMessage<B>
HttpHeaders
objectMutableHttpParameters getParameters()
getParameters
in interface HttpRequest<B>
default MutableHttpRequest<B> accept(MediaType... 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