B
- The body response typepublic interface MutableHttpResponse<B> extends HttpResponse<B>, MutableHttpMessage<B>
HttpResponse
interface that is mutable allowing the ability to set headers,
character encoding etc.Modifier and Type | Method and Description |
---|---|
<T> MutableHttpResponse<T> |
body(T body)
Sets the body.
|
default MutableHttpResponse<B> |
characterEncoding(java.lang.CharSequence encoding)
Sets the response encoding.
|
default MutableHttpResponse<B> |
characterEncoding(java.nio.charset.Charset encoding)
Sets the response encoding.
|
default MutableHttpResponse<B> |
contentEncoding(java.lang.CharSequence encoding)
Sets the content encoding.
|
default MutableHttpResponse<B> |
contentLength(long length)
Sets the content length.
|
default MutableHttpResponse<B> |
contentType(java.lang.CharSequence contentType)
Set the response content type.
|
default MutableHttpResponse<B> |
contentType(MediaType mediaType)
Set the response content type.
|
MutableHttpResponse<B> |
cookie(Cookie cookie)
Adds the specified cookie to the response.
|
default MutableHttpResponse<B> |
cookies(java.util.Set<Cookie> cookies)
Adds the specified cookies to the response.
|
default MutableHttpResponse<B> |
header(java.lang.CharSequence name,
java.lang.CharSequence value)
Set a response header.
|
default MutableHttpResponse<B> |
headers(java.util.function.Consumer<MutableHttpHeaders> headers)
Mutate the headers with the given consumer.
|
default MutableHttpResponse<B> |
headers(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> namesAndValues)
Set multiple headers.
|
default MutableHttpResponse<B> |
locale(java.util.Locale locale)
Sets the locale to use and will apply the appropriate
HttpHeaders.CONTENT_LANGUAGE header to the response. |
default MutableHttpResponse<B> |
status(HttpStatus status)
Sets the response status.
|
MutableHttpResponse<B> |
status(HttpStatus status,
java.lang.CharSequence message)
Sets the response status.
|
default MutableHttpResponse<B> |
status(int status)
Sets the response status.
|
default MutableHttpResponse<B> |
status(int status,
java.lang.CharSequence message)
Sets the response status.
|
accepted, accepted, badRequest, badRequest, body, code, created, created, created, getStatus, header, noContent, notAllowed, notAllowed, notAllowedGeneric, notFound, notFound, notModified, ok, ok, permanentRedirect, reason, redirect, seeOther, serverError, serverError, setAttribute, status, status, status, temporaryRedirect, unauthorized, unprocessableEntity, uri
basicAuth, bearerAuth, getHeaders
getAttributes, getBody, getBody, getBody, getCharacterEncoding, getContentLength, getContentType, getLocale
removeAttribute
getAttribute, getAttribute
MutableHttpResponse<B> cookie(Cookie cookie)
cookie
- the Cookie to return to the clientdefault MutableHttpResponse<B> cookies(java.util.Set<Cookie> cookies)
cookies
- the Set of Cookies to return to the client<T> MutableHttpResponse<T> body(@Nullable T body)
body
in interface MutableHttpMessage<B>
T
- The new body typebody
- The bodyMutableHttpResponse<B> status(HttpStatus status, java.lang.CharSequence message)
status
- The statusmessage
- The messagedefault MutableHttpResponse<B> headers(java.util.function.Consumer<MutableHttpHeaders> headers)
MutableHttpMessage
headers
in interface MutableHttpMessage<B>
headers
- The headersdefault MutableHttpResponse<B> header(java.lang.CharSequence name, java.lang.CharSequence value)
MutableHttpMessage
header
in interface MutableHttpMessage<B>
name
- The name of the headervalue
- The value of the headerdefault MutableHttpResponse<B> headers(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> namesAndValues)
MutableHttpMessage
headers
in interface MutableHttpMessage<B>
namesAndValues
- The names and valuesdefault MutableHttpResponse<B> characterEncoding(java.lang.CharSequence encoding)
contentType(MediaType)
.encoding
- The encoding to usedefault MutableHttpResponse<B> characterEncoding(java.nio.charset.Charset encoding)
encoding
- The encoding to usedefault MutableHttpResponse<B> contentLength(long length)
MutableHttpMessage
contentLength
in interface MutableHttpMessage<B>
length
- The lengthdefault MutableHttpResponse<B> contentType(java.lang.CharSequence contentType)
MutableHttpMessage
contentType
in interface MutableHttpMessage<B>
contentType
- The content typedefault MutableHttpResponse<B> contentType(MediaType mediaType)
MutableHttpMessage
contentType
in interface MutableHttpMessage<B>
mediaType
- The media typedefault MutableHttpResponse<B> contentEncoding(java.lang.CharSequence encoding)
MutableHttpMessage
contentEncoding
in interface MutableHttpMessage<B>
encoding
- The encoding to usedefault MutableHttpResponse<B> locale(java.util.Locale locale)
HttpHeaders.CONTENT_LANGUAGE
header to the response.locale
- The localedefault MutableHttpResponse<B> status(int status)
status
- The statusdefault MutableHttpResponse<B> status(int status, java.lang.CharSequence message)
status
- The statusmessage
- The messagedefault MutableHttpResponse<B> status(HttpStatus status)
status
- The status