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
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic HttpResponseaccepted()Creates a 202 ACCEPTED response.<T> TbodyAsJson(Class<T> clazz) Parses an HTTP body to a specified JSON type using Jackson deserializer.static HttpResponsecreated()Creates a 201 CREATED response.byte[]getBody()static HttpResponseCreates a 204 NO CONTENT response.static HttpResponseof(StatusCode.Success statusCode, String contentType, byte[] body) Creates an HTTP response with specified status code, content type and body.static HttpResponseok()Creates a 200 OK response.static HttpResponseok(byte[] body) Creates a 200 OK response with a application/octet-stream body.static HttpResponseCreates a 200 OK response with a application/json body.static HttpResponseCreates 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.
-