Package kalix.javasdk
Class HttpResponse
Object
kalix.javasdk.HttpResponse
Represents an HTTP response with more level control over the status code, content type and body.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic HttpResponse
accepted()
Creates a 202 ACCEPTED response.<T> T
bodyAsJson
(Class<T> clazz) Parses an HTTP body to a specified JSON type using Jackson deserializer.static HttpResponse
created()
Creates a 201 CREATED response.byte[]
getBody()
static HttpResponse
Creates a 204 NO CONTENT response.static HttpResponse
of
(StatusCode.Success statusCode, String contentType, byte[] body) Creates an HTTP response with specified status code, content type and body.static HttpResponse
ok()
Creates a 200 OK response.static HttpResponse
ok
(byte[] body) Creates a 200 OK response with a application/octet-stream body.static HttpResponse
Creates a 200 OK response with a application/json body.static HttpResponse
Creates a 200 OK response with a text/plain body.
-
Field Details
-
STATUS_CODE_EXTENSION_TYPE_URL
- See Also:
-
-
Method Details
-
getStatusCode
-
getContentType
-
getBody
public byte[] getBody() -
ok
Creates a 200 OK response. -
created
Creates a 201 CREATED response. -
accepted
Creates a 202 ACCEPTED response. -
noContent
Creates a 204 NO CONTENT response. -
ok
Creates a 200 OK response with a text/plain body. -
ok
Creates a 200 OK response with a application/json body. Object is encoded using Jackson serializer. -
ok
Creates a 200 OK response with a application/octet-stream body. -
of
Creates an HTTP response with specified status code, content type and body.- Parameters:
statusCode
- HTTP status codecontentType
- HTTP content typebody
- HTTP body
-
bodyAsJson
Parses an HTTP body to a specified JSON type using Jackson deserializer.
-