Package io.micronaut.http
Interface HttpResponseFactory
- All Known Implementing Classes:
NettyHttpResponseFactory
,SimpleHttpResponseFactory
public interface HttpResponseFactory
A factory interface for creating
MutableHttpResponse
instances.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Modifier and TypeFieldDescriptionstatic final HttpResponseFactory
The defaultHttpResponseFactory
instance. -
Method Summary
Modifier and TypeMethodDescriptiondefault <T> MutableHttpResponse<T>
ok()
<T> MutableHttpResponse<T>
ok
(T body) Creates anHttpStatus.OK
response with a body.<T> MutableHttpResponse<T>
Return a response for the given status.default <T> MutableHttpResponse<T>
status
(HttpStatus status) <T> MutableHttpResponse<T>
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.
-
Field Details
-
INSTANCE
The defaultHttpResponseFactory
instance.
-
-
Method Details
-
ok
Creates anHttpStatus.OK
response with a body.- Type Parameters:
T
- The body type- Parameters:
body
- The body- Returns:
- The ok response with the given body
-
status
Return a response for the given status.- Type Parameters:
T
- The response type- Parameters:
status
- The statusreason
- An alternative reason message- Returns:
- The response
-
status
Return a response for the given status.- Type Parameters:
T
- The response type- Parameters:
status
- The statusreason
- An alternative reason message- Returns:
- The response
-
status
Return a response for the given status.- Type Parameters:
T
- The body type- Parameters:
status
- The statusbody
- The body- Returns:
- The response
-
ok
- Type Parameters:
T
- The response type- Returns:
- The ok response
-
status
- Type Parameters:
T
- The response type- Parameters:
status
- The status- Returns:
- The restus response
-