Class GXOutboundSuccessResponse

java.lang.Object
org.gcube.common.gxrest.response.outbound.GXOutboundSuccessResponse

public class GXOutboundSuccessResponse extends Object
An outbound success response message for applications.
Author:
Manuele Simi (ISTI CNR), Luca Frosini (ISTI-CNR)
  • Method Details

    • newOKResponse

      public static GXOutboundSuccessResponse newOKResponse()
      Builds a new response with the OK HTTP status.
      Returns:
      the updated response
    • newCREATEResponse

      public static GXOutboundSuccessResponse newCREATEResponse(URI location)
      Builds a new response with the CREATE HTTP status.
      Parameters:
      location - the location
      Returns:
      the updated response
    • withContent

      public GXOutboundSuccessResponse withContent(Object o) throws IOException
      Sets the object as response's content. Any Java type instance for a response entity, that is supported by the runtime can be passed.
      Parameters:
      o - the content
      Returns:
      the updated response
      Throws:
      IOException - if an I/O error occurs
    • withContent

      public GXOutboundSuccessResponse withContent(InputStream is) throws IOException
      Reads from the stream the content to set in the response.
      Parameters:
      is - the stream
      Returns:
      the updated response
      Throws:
      IOException - if an I/O error occurs
    • withContent

      public GXOutboundSuccessResponse withContent(String message)
      Sets the message as the response's content.
      Parameters:
      message - the message
      Returns:
      the updated response
    • ofType

      public GXOutboundSuccessResponse ofType(jakarta.ws.rs.core.MediaType type)
      Adds a type to the response message.
      Parameters:
      type - the media type
      Returns:
      the updated response
    • ofType

      public GXOutboundSuccessResponse ofType(String type)
      Adds a type to the response message.
      Parameters:
      type - the media type
      Returns:
      the updated response
    • withHeader

      public GXOutboundSuccessResponse withHeader(String name, Object value)
      Add an arbitrary header.
      Parameters:
      name - the name of the header
      value - the value of the header, the header will be serialized using a RuntimeDelegate.HeaderDelegate if one is available via RuntimeDelegate.createHeaderDelegate(java.lang.Class) for the class of value or using its toString method if a header delegate is not available. If value is null then all current headers of the same name will be removed.
      Returns:
      the updated response.
    • build

      public jakarta.ws.rs.core.Response build()
      Builds the response to return.
      Returns:
      the response