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(java.lang.CharSequence username,
java.lang.CharSequence password)
Set an
HttpHeaders.AUTHORIZATION header, with value: "Basic Base64(username:password)". |
default MutableHttpMessage<B> |
bearerAuth(java.lang.CharSequence token)
Set an
HttpHeaders.AUTHORIZATION header, with value: "Bearer token". |
<T> MutableHttpMessage<T> |
body(T body)
Sets the body.
|
default MutableHttpMessage<B> |
contentEncoding(java.lang.CharSequence encoding)
Sets the content encoding.
|
default MutableHttpMessage<B> |
contentLength(long length)
Sets the content length.
|
default MutableHttpMessage<B> |
contentType(java.lang.CharSequence contentType)
Set the response content type.
|
default MutableHttpMessage<B> |
contentType(MediaType mediaType)
Set the response content type.
|
MutableHttpHeaders |
getHeaders() |
default MutableHttpMessage<B> |
header(java.lang.CharSequence name,
java.lang.CharSequence value)
Set a response header.
|
default MutableHttpMessage<B> |
headers(java.util.function.Consumer<MutableHttpHeaders> headers)
Mutate the headers with the given consumer.
|
default MutableHttpMessage<B> |
headers(java.util.Map<java.lang.CharSequence,java.lang.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(java.util.function.Consumer<MutableHttpHeaders> headers)
headers
- The headersdefault MutableHttpMessage<B> header(java.lang.CharSequence name, java.lang.CharSequence value)
name
- The name of the headervalue
- The value of the headerdefault MutableHttpMessage<B> basicAuth(java.lang.CharSequence username, java.lang.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(java.lang.CharSequence token)
HttpHeaders.AUTHORIZATION
header, with value: "Bearer token".token
- The tokendefault MutableHttpMessage<B> headers(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> namesAndValues)
namesAndValues
- The names and valuesdefault MutableHttpMessage<B> contentLength(long length)
length
- The lengthdefault MutableHttpMessage<B> contentType(java.lang.CharSequence contentType)
contentType
- The content typedefault MutableHttpMessage<B> contentType(MediaType mediaType)
mediaType
- The media typedefault MutableHttpMessage<B> contentEncoding(java.lang.CharSequence encoding)
encoding
- The encoding to use