B
- The response body@Internal public class NettyMutableHttpResponse<B> extends Object implements MutableHttpResponse<B>, NettyHttpResponseBuilder
FullHttpResponse
.Constructor and Description |
---|
NettyMutableHttpResponse(ConversionService conversionService) |
NettyMutableHttpResponse(io.netty.handler.codec.http.FullHttpResponse nettyResponse,
ConversionService conversionService) |
NettyMutableHttpResponse(io.netty.handler.codec.http.HttpVersion httpVersion,
io.netty.handler.codec.http.HttpResponseStatus httpResponseStatus,
ConversionService conversionService)
Creates a new instance.
|
NettyMutableHttpResponse(io.netty.handler.codec.http.HttpVersion httpVersion,
io.netty.handler.codec.http.HttpResponseStatus httpResponseStatus,
io.netty.handler.codec.http.HttpHeaders nettyHeaders,
Object body,
ConversionService conversionService)
Creates a new instance.
|
NettyMutableHttpResponse(io.netty.handler.codec.http.HttpVersion httpVersion,
io.netty.handler.codec.http.HttpResponseStatus httpResponseStatus,
Object body,
ConversionService conversionService)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
<T> MutableHttpResponse<T> |
body(T body)
Sets the body.
|
int |
code() |
MutableHttpResponse<B> |
cookie(Cookie cookie)
Adds the specified cookie to the response.
|
MutableHttpResponse<B> |
cookies(Set<Cookie> cookies)
Adds the specified cookies 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.
|
MutableHttpHeaders |
getHeaders() |
io.netty.handler.codec.http.HttpHeaders |
getNettyHeaders()
The netty headers.
|
io.netty.handler.codec.http.HttpResponseStatus |
getNettyHttpStatus()
The netty http response status.
|
io.netty.handler.codec.http.HttpVersion |
getNettyHttpVersion()
The netty http version.
|
io.netty.handler.codec.http.cookie.ServerCookieEncoder |
getServerCookieEncoder() |
HttpStatus |
getStatus() |
boolean |
isStream() |
String |
reason() |
void |
setServerCookieEncoder(io.netty.handler.codec.http.cookie.ServerCookieEncoder serverCookieEncoder) |
MutableHttpResponse<B> |
status(HttpStatus status,
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.
|
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
attribute, characterEncoding, characterEncoding, contentEncoding, contentLength, contentType, contentType, header, headers, headers, locale, status, status, status
accepted, accepted, badRequest, badRequest, body, created, created, created, getCookie, getCookies, header, noContent, notAllowed, notAllowed, notAllowedGeneric, notFound, notFound, notModified, ok, ok, permanentRedirect, redirect, seeOther, serverError, serverError, setAttribute, status, status, status, temporaryRedirect, unauthorized, unprocessableEntity, uri
basicAuth, bearerAuth
getCharacterEncoding, getContentLength, getContentType, getLocale
removeAttribute
getAttribute, getAttribute
toHttpResponse, toStreamResponse
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 NettyMutableHttpResponse(io.netty.handler.codec.http.HttpVersion httpVersion, io.netty.handler.codec.http.HttpResponseStatus httpResponseStatus, ConversionService conversionService)
httpVersion
- The http versionhttpResponseStatus
- THe http response statusconversionService
- The conversion servicepublic NettyMutableHttpResponse(io.netty.handler.codec.http.HttpVersion httpVersion, io.netty.handler.codec.http.HttpResponseStatus httpResponseStatus, Object body, ConversionService conversionService)
httpVersion
- The http versionhttpResponseStatus
- THe http response statusbody
- The bodyconversionService
- The conversion servicepublic NettyMutableHttpResponse(io.netty.handler.codec.http.HttpVersion httpVersion, io.netty.handler.codec.http.HttpResponseStatus httpResponseStatus, io.netty.handler.codec.http.HttpHeaders nettyHeaders, Object body, ConversionService conversionService)
httpVersion
- The http versionhttpResponseStatus
- THe http response statusnettyHeaders
- The http headersbody
- The bodyconversionService
- The conversion servicepublic io.netty.handler.codec.http.HttpVersion getNettyHttpVersion()
public io.netty.handler.codec.http.HttpResponseStatus getNettyHttpStatus()
public io.netty.handler.codec.http.HttpHeaders getNettyHeaders()
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 int code()
code
in interface HttpResponse<B>
public String reason()
reason
in interface HttpResponse<B>
public MutableHttpResponse<B> cookie(Cookie cookie)
MutableHttpResponse
cookie
in interface MutableHttpResponse<B>
cookie
- the Cookie to return to the clientpublic MutableHttpResponse<B> cookies(Set<Cookie> cookies)
MutableHttpResponse
cookies
in interface MutableHttpResponse<B>
cookies
- the Set of Cookies 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 <T> MutableHttpResponse<T> body(@Nullable T body)
MutableHttpResponse
body
in interface MutableHttpMessage<B>
body
in interface MutableHttpResponse<B>
T
- The new body typebody
- The bodypublic 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()
NettyHttpResponseBuilder
toFullHttpResponse
in interface NettyHttpResponseBuilder
@NonNull public StreamedHttpResponse toStreamHttpResponse()
NettyHttpResponseBuilder
toStreamHttpResponse
in interface NettyHttpResponseBuilder
@NonNull public io.netty.handler.codec.http.HttpResponse toHttpResponse()
NettyHttpResponseBuilder
toHttpResponse
in interface NettyHttpResponseBuilder
public boolean isStream()
isStream
in interface NettyHttpResponseBuilder