@Internal public class NettyHttpResponseFactory extends java.lang.Object implements HttpResponseFactory
HttpResponseFactory
for Netty.INSTANCE
Constructor and Description |
---|
NettyHttpResponseFactory() |
Modifier and Type | Method and Description |
---|---|
static java.util.Optional<NettyMutableHttpResponse> |
get(NettyHttpRequest<?> request)
Lookup the response from the request.
|
static NettyMutableHttpResponse |
getOr(NettyHttpRequest<?> request,
HttpResponse<?> alternative)
Lookup the response from the context.
|
static NettyMutableHttpResponse |
getOrCreate(NettyHttpRequest<?> request)
Lookup the response from the context.
|
<T> MutableHttpResponse<T> |
ok(T body)
Creates an
HttpStatus.OK response with a body. |
static java.util.Optional<NettyMutableHttpResponse> |
set(NettyHttpRequest<?> request,
HttpResponse<?> response)
Lookup the response from the request.
|
MutableHttpResponse |
status(HttpStatus status,
java.lang.String reason)
Return a response for the given status.
|
<T> MutableHttpResponse<T> |
status(HttpStatus status,
T body)
Return a response for the given status.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
ok, status
public <T> MutableHttpResponse<T> ok(T body)
HttpResponseFactory
HttpStatus.OK
response with a body.ok
in interface HttpResponseFactory
T
- The body typebody
- The bodypublic <T> MutableHttpResponse<T> status(HttpStatus status, T body)
HttpResponseFactory
status
in interface HttpResponseFactory
T
- The body typestatus
- The statusbody
- The bodypublic MutableHttpResponse status(HttpStatus status, java.lang.String reason)
HttpResponseFactory
status
in interface HttpResponseFactory
status
- The statusreason
- An alternatively reason message@Internal public static NettyMutableHttpResponse getOrCreate(NettyHttpRequest<?> request)
request
- The contextNettyMutableHttpResponse
@Internal public static NettyMutableHttpResponse getOr(NettyHttpRequest<?> request, HttpResponse<?> alternative)
request
- The contextalternative
- The alternative HttpResponseNettyMutableHttpResponse
@Internal public static java.util.Optional<NettyMutableHttpResponse> get(NettyHttpRequest<?> request)
request
- The requestNettyMutableHttpResponse
@Internal public static java.util.Optional<NettyMutableHttpResponse> set(NettyHttpRequest<?> request, HttpResponse<?> response)
request
- The requestresponse
- The Http ResponseNettyMutableHttpResponse