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 |
---|---|
default MutableHttpResponse<B> |
attribute(CharSequence name,
Object value)
Sets an attribute on the response.
|
<T> MutableHttpResponse<T> |
body(T body)
Sets the body.
|
default MutableHttpResponse<B> |
characterEncoding(CharSequence encoding)
Sets the response encoding.
|
default MutableHttpResponse<B> |
characterEncoding(Charset encoding)
Sets the response encoding.
|
default MutableHttpResponse<B> |
contentEncoding(CharSequence encoding)
Sets the content encoding.
|
default MutableHttpResponse<B> |
contentLength(long length)
Sets the content length.
|
default MutableHttpResponse<B> |
contentType(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(Set<Cookie> cookies)
Adds the specified cookies to the response.
|
default MutableHttpResponse<B> |
header(CharSequence name,
CharSequence value)
Set a response header.
|
default MutableHttpResponse<B> |
headers(Consumer<MutableHttpHeaders> headers)
Mutate the headers with the given consumer.
|
default MutableHttpResponse<B> |
headers(Map<CharSequence,CharSequence> namesAndValues)
Set multiple headers.
|
default MutableHttpResponse<B> |
locale(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,
CharSequence message)
Sets the response status.
|
default MutableHttpResponse<B> |
status(int status)
Sets the response status.
|
default MutableHttpResponse<B> |
status(int status,
CharSequence message)
Sets the response status.
|
accepted, accepted, badRequest, badRequest, body, code, created, created, created, getCookie, getCookies, 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(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, CharSequence message)
status
- The statusmessage
- The messagedefault MutableHttpResponse<B> headers(Consumer<MutableHttpHeaders> headers)
MutableHttpMessage
headers
in interface MutableHttpMessage<B>
headers
- The headersdefault MutableHttpResponse<B> header(CharSequence name, CharSequence value)
MutableHttpMessage
header
in interface MutableHttpMessage<B>
name
- The name of the headervalue
- The value of the headerdefault MutableHttpResponse<B> headers(Map<CharSequence,CharSequence> namesAndValues)
MutableHttpMessage
headers
in interface MutableHttpMessage<B>
namesAndValues
- The names and valuesdefault MutableHttpResponse<B> characterEncoding(CharSequence encoding)
contentType(MediaType)
.encoding
- The encoding to usedefault MutableHttpResponse<B> characterEncoding(Charset encoding)
encoding
- The encoding to usedefault MutableHttpResponse<B> contentLength(long length)
MutableHttpMessage
contentLength
in interface MutableHttpMessage<B>
length
- The lengthdefault MutableHttpResponse<B> contentType(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(CharSequence encoding)
MutableHttpMessage
contentEncoding
in interface MutableHttpMessage<B>
encoding
- The encoding to usedefault MutableHttpResponse<B> locale(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, CharSequence message)
status
- The statusmessage
- The messagedefault MutableHttpResponse<B> status(HttpStatus status)
status
- The statusdefault MutableHttpResponse<B> attribute(CharSequence name, Object value)
name
- The attribute namevalue
- The attribute value