com.ibm.wsspi.zos.connect

Interface ResponseData

  • All Superinterfaces:
    Data


    public interface ResponseData
    extends Data
    Defines an Object that holds response data associated to a specific request.

    Callers setting response payloads are not allowed to set more than one type of response object. Doing so, results in an IllegalStateException.

    Operations that dynamically process data conversion expect a data transformation service to have been configured. If one is not present, a DataXformException is raised.

    This interface is implemented by z/OS Connect.

    • Method Detail

      • setJSON

        void setJSON(com.ibm.json.java.JSONObject jsonObject)
                     throws java.io.IOException
        Sets the JSONObject to be set in the response.
        Parameters:
        jsonObject - The JSONObject to set in the response. Null if there is no response.
        Throws:
        java.lang.IllegalStateException - If the response already contains a return object.
        java.io.IOException - If an error occurred while serializing the input JSON object.
      • setBytes

        void setBytes(byte[] bytes)
                      throws DataXformException,
                             java.io.IOException
        Sets a byte array output to be converted to a JSONObject. The input payload is converted using the configured data transformation service. If the data transformation service isn't configured, the bytes represent a JSON response encoded in UTF-8, and are treated as the response data. In this scenario the data is not converted to a JSONObject, and no further validation of the response is performed.
        Parameters:
        bytes - The output bytes.
        Throws:
        java.lang.IllegalStateException - If the response already contains a return object.
        DataXformException - If there was an error while dynamically transforming the byte array payload to a JSONObject or if a data transformation service is not available to convert the payload.
        java.io.IOException - If an error occurred while serializing the JSON object obtained from the data transformer.
      • setHttpResponseCode

        void setHttpResponseCode(int httpServletResponseCode)
        Sets the HTTP servlet response code to be set in the response back to the caller.
        Parameters:
        httpServletResponseCode - The HTTP servlet's response code.