Class ServiceResponse

java.lang.Object
io.vertx.ext.web.api.service.ServiceResponse

public class ServiceResponse extends Object
Data object that encapsulates all informations about an HTTP Response
  • Constructor Details

    • ServiceResponse

      public ServiceResponse()
    • ServiceResponse

      public ServiceResponse(JsonObject json)
    • ServiceResponse

      public ServiceResponse(Integer statusCode, String statusMessage, Buffer payload, MultiMap headers)
    • ServiceResponse

      public ServiceResponse(ServiceResponse other)
  • Method Details

    • toJson

      public JsonObject toJson()
    • getStatusCode

      public Integer getStatusCode()
    • getStatusMessage

      public String getStatusMessage()
    • getPayload

      public Buffer getPayload()
    • getHeaders

      public MultiMap getHeaders()
    • setHeaders

      public ServiceResponse setHeaders(MultiMap headers)
    • setStatusCode

      public ServiceResponse setStatusCode(Integer statusCode)
    • setStatusMessage

      public ServiceResponse setStatusMessage(String statusMessage)
    • setPayload

      public ServiceResponse setPayload(Buffer payload)
    • putHeader

      public ServiceResponse putHeader(String key, String value)
    • completedWithJson

      public static ServiceResponse completedWithJson(JsonObject jsonObject)
      Creates a ServiceResponse with status code 200, status message OK, content type application/json and jsonObject as body
      Parameters:
      jsonObject -
      Returns:
    • completedWithJson

      public static ServiceResponse completedWithJson(JsonArray jsonArray)
      Creates a ServiceResponse with status code 200, status message OK, content type application/json and jsonArray as body
      Parameters:
      jsonArray -
      Returns:
    • completedWithJson

      public static ServiceResponse completedWithJson(Buffer json)
      Creates a ServiceResponse with status code 200, status message OK, content type application/json and json as body
      Parameters:
      json -
      Returns:
    • completedWithPlainText

      public static ServiceResponse completedWithPlainText(Buffer text)
      Creates a ServiceResponse with status code 200, status message OK, content type text/plain and text as body
      Parameters:
      text -
      Returns: