B
- The body typepublic interface MutableHttpMessage<B> extends HttpMessage<B>
HttpMessage
that is mutable allowing headers and the message body to be set.Modifier and Type | Method and Description |
---|---|
default MutableHttpMessage<B> |
basicAuth(CharSequence username,
CharSequence password)
Set an
HttpHeaders.AUTHORIZATION header, with value: "Basic Base64(username:password)". |
default MutableHttpMessage<B> |
bearerAuth(CharSequence token)
Set an
HttpHeaders.AUTHORIZATION header, with value: "Bearer token". |
<T> MutableHttpMessage<T> |
body(T body)
Sets the body.
|
default MutableHttpMessage<B> |
contentEncoding(CharSequence encoding)
Sets the content encoding.
|
default MutableHttpMessage<B> |
contentLength(long length)
Sets the content length.
|
default MutableHttpMessage<B> |
contentType(CharSequence contentType)
Set the response content type.
|
default MutableHttpMessage<B> |
contentType(MediaType mediaType)
Set the response content type.
|
MutableHttpHeaders |
getHeaders() |
default MutableHttpMessage<B> |
header(CharSequence name,
CharSequence value)
Set a response header.
|
default MutableHttpMessage<B> |
headers(Consumer<MutableHttpHeaders> headers)
Mutate the headers with the given consumer.
|
default MutableHttpMessage<B> |
headers(Map<CharSequence,CharSequence> namesAndValues)
Set multiple headers.
|
getAttributes, getBody, getBody, getBody, getCharacterEncoding, getContentLength, getContentType, getLocale, setAttribute
removeAttribute
getAttribute, getAttribute
MutableHttpHeaders getHeaders()
getHeaders
in interface HttpMessage<B>
MutableHttpHeaders
object<T> MutableHttpMessage<T> body(T body)
T
- The new body typebody
- The bodydefault MutableHttpMessage<B> headers(Consumer<MutableHttpHeaders> headers)
headers
- The headersdefault MutableHttpMessage<B> header(CharSequence name, CharSequence value)
name
- The name of the headervalue
- The value of the headerdefault MutableHttpMessage<B> basicAuth(CharSequence username, CharSequence password)
HttpHeaders.AUTHORIZATION
header, with value: "Basic Base64(username:password)".username
- The username part of the credentialspassword
- The password part of the credentialsdefault MutableHttpMessage<B> bearerAuth(CharSequence token)
HttpHeaders.AUTHORIZATION
header, with value: "Bearer token".token
- The tokendefault MutableHttpMessage<B> headers(Map<CharSequence,CharSequence> namesAndValues)
namesAndValues
- The names and valuesdefault MutableHttpMessage<B> contentLength(long length)
length
- The lengthdefault MutableHttpMessage<B> contentType(CharSequence contentType)
contentType
- The content typedefault MutableHttpMessage<B> contentType(MediaType mediaType)
mediaType
- The media typedefault MutableHttpMessage<B> contentEncoding(CharSequence encoding)
encoding
- The encoding to use