B - The response body@Internal public class NettyMutableHttpResponse<B> extends java.lang.Object implements MutableHttpResponse<B>, NettyHttpResponseBuilder
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 |
|---|---|
<T> MutableHttpResponse<T> |
body(T body)
Sets the body.
|
MutableHttpResponse<B> |
cookie(Cookie cookie)
Adds the specified cookie to the response.
|
MutableHttpResponse<B> |
cookies(java.util.Set<Cookie> cookies)
Adds the specified cookies to the response.
|
MutableConvertibleValues<java.lang.Object> |
getAttributes()
A
MutableConvertibleValues of the attributes for this HTTP message. |
java.util.Optional<B> |
getBody() |
<T> java.util.Optional<T> |
getBody(Argument<T> type)
Return the body as the given type.
|
<T1> java.util.Optional<T1> |
getBody(java.lang.Class<T1> type)
Return the body as the given type.
|
java.util.Optional<MediaType> |
getContentType()
The request or response content type.
|
MutableHttpHeaders |
getHeaders() |
io.netty.handler.codec.http.FullHttpResponse |
getNativeResponse() |
io.netty.handler.codec.http.cookie.ServerCookieEncoder |
getServerCookieEncoder() |
HttpStatus |
getStatus() |
boolean |
isStream() |
NettyMutableHttpResponse |
replace(io.netty.buffer.ByteBuf body) |
void |
setServerCookieEncoder(io.netty.handler.codec.http.cookie.ServerCookieEncoder serverCookieEncoder) |
MutableHttpResponse<B> |
status(HttpStatus status,
java.lang.CharSequence message)
Sets the response status.
|
io.netty.handler.codec.http.FullHttpResponse |
toFullHttpResponse()
Converts this object to a full http response.
|
io.netty.handler.codec.http.HttpResponse |
toHttpResponse()
Converts this object to the most appropriate http response type.
|
StreamedHttpResponse |
toStreamHttpResponse()
Converts this object to a streamed http response.
|
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcharacterEncoding, characterEncoding, contentEncoding, contentLength, contentType, contentType, header, headers, headers, locale, status, status, statusaccepted, accepted, badRequest, badRequest, body, code, created, created, created, getCookie, getCookies, header, noContent, notAllowed, notAllowed, notAllowedGeneric, notFound, notFound, notModified, ok, ok, permanentRedirect, reason, redirect, seeOther, serverError, serverError, setAttribute, status, status, status, temporaryRedirect, unauthorized, unprocessableEntity, uribasicAuth, bearerAuthgetCharacterEncoding, getContentLength, getLocaleremoveAttributegetAttribute, getAttributetoHttpResponse, toStreamResponsepublic NettyMutableHttpResponse(io.netty.handler.codec.http.FullHttpResponse nettyResponse,
ConversionService conversionService)
nettyResponse - The FullHttpResponseconversionService - The conversion servicepublic NettyMutableHttpResponse(ConversionService conversionService)
conversionService - The conversion servicepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Optional<MediaType> getContentType()
HttpMessagegetContentType in interface HttpMessage<B>public MutableHttpHeaders getHeaders()
getHeaders in interface HttpMessage<B>getHeaders in interface MutableHttpMessage<B>HttpHeaders objectpublic MutableConvertibleValues<java.lang.Object> getAttributes()
HttpMessageA 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 AttributeHoldergetAttributes in interface MutableAttributeHoldergetAttributes in interface HttpMessage<B>public HttpStatus getStatus()
getStatus in interface HttpResponse<B>public MutableHttpResponse<B> cookie(Cookie cookie)
MutableHttpResponsecookie in interface MutableHttpResponse<B>cookie - the Cookie to return to the clientpublic MutableHttpResponse<B> cookies(java.util.Set<Cookie> cookies)
MutableHttpResponsecookies in interface MutableHttpResponse<B>cookies - the Set of Cookies to return to the clientpublic java.util.Optional<B> getBody()
getBody in interface HttpMessage<B>public <T1> java.util.Optional<T1> getBody(java.lang.Class<T1> type)
HttpMessagegetBody 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> java.util.Optional<T> getBody(Argument<T> type)
HttpMessagegetBody 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, java.lang.CharSequence message)
MutableHttpResponsestatus in interface MutableHttpResponse<B>status - The statusmessage - The messagepublic io.netty.handler.codec.http.FullHttpResponse getNativeResponse()
FullHttpResponsepublic <T> MutableHttpResponse<T> body(@Nullable T body)
MutableHttpResponsebody in interface MutableHttpMessage<B>body in interface MutableHttpResponse<B>T - The new body typebody - The bodypublic NettyMutableHttpResponse replace(io.netty.buffer.ByteBuf body)
body - The body to replacepublic io.netty.handler.codec.http.cookie.ServerCookieEncoder getServerCookieEncoder()
public void setServerCookieEncoder(io.netty.handler.codec.http.cookie.ServerCookieEncoder serverCookieEncoder)
serverCookieEncoder - Server cookie encoder@NonNull public io.netty.handler.codec.http.FullHttpResponse toFullHttpResponse()
NettyHttpResponseBuildertoFullHttpResponse in interface NettyHttpResponseBuilder@NonNull public StreamedHttpResponse toStreamHttpResponse()
NettyHttpResponseBuildertoStreamHttpResponse in interface NettyHttpResponseBuilder@NonNull public io.netty.handler.codec.http.HttpResponse toHttpResponse()
NettyHttpResponseBuildertoHttpResponse in interface NettyHttpResponseBuilderpublic boolean isStream()
isStream in interface NettyHttpResponseBuilder