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
FieldsModifier and TypeFieldDescriptionstatic final HttpResponseFactoryThe defaultHttpResponseFactoryinstance. -
Method Summary
Modifier and TypeMethodDescriptiondefault <T> MutableHttpResponse<T>ok()<T> MutableHttpResponse<T>ok(T body) Creates anHttpStatus.OKresponse 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 defaultHttpResponseFactoryinstance.
-
-
Method Details
-
ok
Creates anHttpStatus.OKresponse 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
-