Package io.micronaut.http.simple
Class SimpleHttpResponseFactory
- java.lang.Object
-
- io.micronaut.http.simple.SimpleHttpResponseFactory
-
- All Implemented Interfaces:
HttpResponseFactory
public class SimpleHttpResponseFactory extends java.lang.Object implements HttpResponseFactory
SimpleHttpResponseFactory
implementation. This is the default fallback factory.- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.http.HttpResponseFactory
INSTANCE
-
-
Constructor Summary
Constructors Constructor Description SimpleHttpResponseFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> MutableHttpResponse<T>
ok(T body)
Creates anHttpStatus.OK
response with a body.<T> MutableHttpResponse<T>
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.-
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
-
-
-
-
Method Detail
-
ok
public <T> MutableHttpResponse<T> ok(T body)
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
public <T> MutableHttpResponse<T> status(HttpStatus status, java.lang.String reason)
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
-
status
public <T> MutableHttpResponse<T> status(HttpStatus status, T body)
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
-
-