B
- The response body@Internal public class NettyMutableHttpResponse<B> extends Object implements MutableHttpResponse<B>
FullHttpResponse
.Modifier and Type | Field and Description |
---|---|
protected io.netty.handler.codec.http.FullHttpResponse |
nettyResponse |
Constructor and Description |
---|
NettyMutableHttpResponse(ConversionService conversionService) |
NettyMutableHttpResponse(io.netty.handler.codec.http.FullHttpResponse nettyResponse,
ConversionService conversionService) |
Modifier and Type | Method and Description |
---|---|
NettyMutableHttpResponse<B> |
body(B body)
Sets the body.
|
MutableHttpResponse<B> |
cookie(Cookie cookie)
Adds the specified cookie to the response.
|
MutableConvertibleValues<Object> |
getAttributes()
A
MutableConvertibleValues of the attributes for this HTTP message. |
Optional<B> |
getBody() |
<T> Optional<T> |
getBody(Argument<T> type)
Return the body as the given type.
|
<T1> Optional<T1> |
getBody(Class<T1> type)
Return the body as the given type.
|
Optional<MediaType> |
getContentType()
The request or response content type.
|
MutableHttpHeaders |
getHeaders() |
io.netty.handler.codec.http.FullHttpResponse |
getNativeResponse() |
HttpStatus |
getStatus() |
NettyMutableHttpResponse |
replace(io.netty.buffer.ByteBuf body) |
MutableHttpResponse<B> |
status(HttpStatus status,
CharSequence message)
Sets the response status.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
characterEncoding, characterEncoding, contentEncoding, contentLength, contentType, contentType, header, headers, headers, locale, status, status, status
accepted, accepted, badRequest, badRequest, body, code, created, created, created, header, noContent, notAllowed, notAllowed, notFound, notFound, notModified, ok, ok, permanentRedirect, reason, redirect, seeOther, serverError, serverError, setAttribute, status, status, status, temporaryRedirect, unauthorized, unprocessableEntity, uri
basicAuth, bearerAuth
getCharacterEncoding, getContentLength, getLocale
removeAttribute
getAttribute, getAttribute
public NettyMutableHttpResponse(io.netty.handler.codec.http.FullHttpResponse nettyResponse, ConversionService conversionService)
nettyResponse
- The FullHttpResponse
conversionService
- The conversion servicepublic NettyMutableHttpResponse(ConversionService conversionService)
conversionService
- The conversion servicepublic Optional<MediaType> getContentType()
HttpMessage
getContentType
in interface HttpMessage<B>
public MutableHttpHeaders getHeaders()
getHeaders
in interface HttpMessage<B>
getHeaders
in interface MutableHttpMessage<B>
HttpHeaders
objectpublic MutableConvertibleValues<Object> getAttributes()
HttpMessage
A MutableConvertibleValues
of the attributes for this HTTP message.
Attributes are designed for internal data sharing and hence are isolated from headers and parameters which are client supplied
getAttributes
in interface AttributeHolder
getAttributes
in interface MutableAttributeHolder
getAttributes
in interface HttpMessage<B>
public HttpStatus getStatus()
getStatus
in interface HttpResponse<B>
public MutableHttpResponse<B> cookie(Cookie cookie)
MutableHttpResponse
cookie
in interface MutableHttpResponse<B>
cookie
- the Cookie to return to the clientpublic Optional<B> getBody()
getBody
in interface HttpMessage<B>
public <T1> Optional<T1> getBody(Class<T1> type)
HttpMessage
getBody
in interface HttpMessage<B>
T1
- The generic typetype
- The type of the bodyOptional
of the type or Optional.empty()
if the body cannot be returned as the given typepublic <T> Optional<T> getBody(Argument<T> type)
HttpMessage
getBody
in interface HttpMessage<B>
T
- The generic typetype
- The type of the bodyOptional
of the type or Optional.empty()
if the body cannot be returned as the given typepublic MutableHttpResponse<B> status(HttpStatus status, CharSequence message)
MutableHttpResponse
status
in interface MutableHttpResponse<B>
status
- The statusmessage
- The messagepublic io.netty.handler.codec.http.FullHttpResponse getNativeResponse()
FullHttpResponse
public NettyMutableHttpResponse<B> body(B body)
MutableHttpResponse
body
in interface MutableHttpMessage<B>
body
in interface MutableHttpResponse<B>
body
- The bodypublic NettyMutableHttpResponse replace(io.netty.buffer.ByteBuf body)
body
- The body to replace