Package io.micronaut.http.server.netty
Class NettyHttpResponseFactory
java.lang.Object
io.micronaut.http.server.netty.NettyHttpResponseFactory
- All Implemented Interfaces:
HttpResponseFactory
Implementation of
HttpResponseFactory
for Netty.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Fields inherited from interface io.micronaut.http.HttpResponseFactory
INSTANCE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 anHttpStatus.OK
response with a body.static Optional<NettyMutableHttpResponse>
set
(NettyHttpRequest<?> request, HttpResponse<?> response) Lookup the response from the request.<T> MutableHttpResponse<T>
Return a response for the given status.status
(HttpStatus status, String reason) Return a response for the given status.<T> MutableHttpResponse<T>
status
(HttpStatus status, T body) Return a response for the given status.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.http.HttpResponseFactory
ok, status
-
Constructor Details
-
NettyHttpResponseFactory
public NettyHttpResponseFactory()
-
-
Method Details
-
ok
Description copied from interface:HttpResponseFactory
Creates anHttpStatus.OK
response with a body.- Specified by:
ok
in interfaceHttpResponseFactory
- Type Parameters:
T
- The body type- Parameters:
body
- The body- Returns:
- The ok response with the given body
-
status
Description copied from interface:HttpResponseFactory
Return a response for the given status.- Specified by:
status
in interfaceHttpResponseFactory
- Type Parameters:
T
- The body type- Parameters:
status
- The statusbody
- The body- Returns:
- The response
-
status
Description copied from interface:HttpResponseFactory
Return a response for the given status.- Specified by:
status
in interfaceHttpResponseFactory
- Parameters:
status
- The statusreason
- An alternatively reason message- Returns:
- The response
-
status
Description copied from interface:HttpResponseFactory
Return a response for the given status.- Specified by:
status
in interfaceHttpResponseFactory
- Type Parameters:
T
- The response type- Parameters:
status
- The statusreason
- An alternatively reason message- Returns:
- The response
-
getOrCreate
Lookup the response from the context.- Parameters:
request
- The context- Returns:
- The
NettyMutableHttpResponse
-
getOr
@Internal public static NettyMutableHttpResponse getOr(NettyHttpRequest<?> request, HttpResponse<?> alternative) Lookup the response from the context.- Parameters:
request
- The contextalternative
- The alternative HttpResponse- Returns:
- The
NettyMutableHttpResponse
-
get
Lookup the response from the request.- Parameters:
request
- The request- Returns:
- The
NettyMutableHttpResponse
-
set
@Internal public static Optional<NettyMutableHttpResponse> set(NettyHttpRequest<?> request, HttpResponse<?> response) Lookup the response from the request.- Parameters:
request
- The requestresponse
- The Http Response- Returns:
- The
NettyMutableHttpResponse
-