public class ServiceResponse extends Object
Constructor and Description |
---|
ServiceResponse() |
ServiceResponse(Integer statusCode,
String statusMessage,
Buffer payload,
MultiMap headers) |
ServiceResponse(JsonObject json) |
ServiceResponse(ServiceResponse other) |
Modifier and Type | Method and Description |
---|---|
static ServiceResponse |
completedWithJson(Buffer json)
Creates a
ServiceResponse with status code 200, status message OK, content type application/json and json as body |
static ServiceResponse |
completedWithJson(JsonArray jsonArray)
Creates a
ServiceResponse with status code 200, status message OK, content type application/json and jsonArray as body |
static ServiceResponse |
completedWithJson(JsonObject jsonObject)
Creates a
ServiceResponse with status code 200, status message OK, content type application/json and jsonObject as body |
static ServiceResponse |
completedWithPlainText(Buffer text)
Creates a
ServiceResponse with status code 200, status message OK, content type text/plain and text as body |
MultiMap |
getHeaders() |
Buffer |
getPayload() |
Integer |
getStatusCode() |
String |
getStatusMessage() |
ServiceResponse |
putHeader(String key,
String value) |
ServiceResponse |
setHeaders(MultiMap headers) |
ServiceResponse |
setPayload(Buffer payload) |
ServiceResponse |
setStatusCode(Integer statusCode) |
ServiceResponse |
setStatusMessage(String statusMessage) |
JsonObject |
toJson() |
public ServiceResponse()
public ServiceResponse(JsonObject json)
public ServiceResponse(Integer statusCode, String statusMessage, Buffer payload, MultiMap headers)
public ServiceResponse(ServiceResponse other)
public JsonObject toJson()
public Integer getStatusCode()
public String getStatusMessage()
public Buffer getPayload()
public MultiMap getHeaders()
public ServiceResponse setHeaders(MultiMap headers)
public ServiceResponse setStatusCode(Integer statusCode)
public ServiceResponse setStatusMessage(String statusMessage)
public ServiceResponse setPayload(Buffer payload)
public ServiceResponse putHeader(String key, String value)
public static ServiceResponse completedWithJson(JsonObject jsonObject)
ServiceResponse
with status code 200, status message OK, content type application/json
and jsonObject
as bodyjsonObject
- public static ServiceResponse completedWithJson(JsonArray jsonArray)
ServiceResponse
with status code 200, status message OK, content type application/json
and jsonArray
as bodyjsonArray
- public static ServiceResponse completedWithJson(Buffer json)
ServiceResponse
with status code 200, status message OK, content type application/json
and json
as bodyjson
- public static ServiceResponse completedWithPlainText(Buffer text)
ServiceResponse
with status code 200, status message OK, content type text/plain
and text
as bodytext
- Copyright © 2021 Eclipse. All rights reserved.