com.ibm.cics.server

Class HttpResponse



  • public class HttpResponse
    extends API

    This class provides the Java implementation of HTTP responses related to the following CICS API WEB server commands:

    • WEB WRITE
    • WEB SEND.

    The writeHeader() method allows HTTP header information to be added to a response. This is equivalent to CICS API command WEB WRITE.

    The setter methods allow instance variables to be set in the HttpResponse object. These variables relate to the following options on the CICS API command WEB SEND:

    • SERVERCONV SRVCONVERT
    • SERVERCONV NOSRVCONVERT
    • CHARACTERSET
    • HOSTCODEPAGE
    • CLOSESTATUS CLOSE
    • CLOSESTATUS NOCLOSE
    • ACTION EVENTUAL
    • ACTION IMMEDIATE
    • DOCSTATUS DOCDELETE
    • DOCSTATUS NODOCDELETE

    The sendDocument() method sends the specified Document object to the clients browser. This is equivalent to CICS API command WEB SEND DOCUMENT.

    The sendFrom() method sends an application buffer to the clients browser. This is equivalent to CICS API command WEB SEND FROM.

    The sendChunk() sends a chunk of a chunked response to the client. When all the chunks of the chunked response have been sent the sendLastChunk() method must be used to terminate the chunked response. This is equivalent to using CICS API commands WEB SEND FROM CHUNKYES and WEB SEND CHUNKEND to send a chunked response.

    The sendContainer() method sends the data held in a named container to the client. This is equivalent to CICS API command WEB SEND CONTAINER.

    A equivalent method for CICS API command WEB RETRIEVE is not supplied. This command returns the DOCTOKEN of the document sent using an earlier WEB SEND command. The Document object sent by the sendDocument() method should still be available so a method equivalent to this command is not required.

    See Also:
    com.ibm.cics.server.API for general restrictions on using the JCICS API.
    Since CICS TS version:
    2.3
    Since package version:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int NOTSET
      Constant - NOT SET
    • Constructor Summary

      Constructors 
      Constructor and Description
      HttpResponse()
      Usage:
      Public default constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void sendChunk(byte[] from)
      Usage:
      Send a chunk of the chunked response to the client.
      void sendChunk(java.lang.String from)
      Usage:
      Send a chunk of the chunked response to the client.
      void sendContainer(Container container)
      Usage:
      Send the data stored in a container to the client.
      void sendDocument(Document doc)
      Usage:
      Send a document to the client.
      void sendDocument(Document doc, short statusCode, java.lang.String statusText, java.lang.String characterset)
      Usage:
      Send a document to the client.
      void sendFrom(byte[] from)
      Usage:
      Send an application buffer to the client.
      void sendFrom(java.lang.String from)
      Usage:
      Send an application buffer to the client.
      void sendLastChunk()
      Usage:
      Indicate that the chunked response is complete.
      void setActionEventual()
      Usage:
      Sets WEB SEND command option ACTION to EVENTUAL.
      void setActionImmediate()
      Usage:
      Sets WEB SEND command option ACTION to IMMEDIATE.
      void setCharacterset(java.lang.String characterset)
      Usage:
      Sets WEB SEND command option CHARACTERSET.
      void setClientCodePage(java.lang.String characterset)
      Usage:
      Sets WEB SEND command option CHARACTERSET.
      void setClose()
      Usage:
      Sets WEB SEND command option CLOSESTATUS to CLOSE.
      void setDocDelete()
      Usage:
      Sets WEB SEND command option DOCSTATUS to DOCDELETE.
      void setHostCodePage(java.lang.String hostCodePage)
      Usage:
      Sets WEB SEND command option HOSTCODEPAGE.
      void setMediaType(java.lang.String mediaType)
      Usage:
      Sets WEB SEND command option MEDIATYPE.
      void setNoClose()
      Usage:
      Sets WEB SEND command option CLOSESTATUS to NOCLOSE.
      void setNoDocDelete()
      Usage:
      Sets WEB SEND command option DOCSTATUS to NODOCDELETE.
      void setNoServerConvert()
      Usage:
      Sets WEB SEND command option SERVERCONV to NOSRVCONVERT.
      void setServerConvert()
      Usage:
      Sets WEB SEND command option SERVERCONV to SRVCONVERT.
      void setStatus(short statusCode, java.lang.String statusText)
      Usage:
      Sets WEB SEND command option STATUSCODE and STATUSTEXT..
      void writeHeader(java.lang.String header, java.lang.String value)
      Usage:
      Add HTTP header information to the response.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • NOTSET

        public static final int NOTSET
        Constant - NOT SET
        See Also:
        Constant Field Values
        Since CICS TS version:
        2.3
        Since package version:
        1.0
    • Constructor Detail

      • HttpResponse

        public HttpResponse()
        Usage:
        Public default constructor.

        Since CICS TS version:
        2.3
        Since package version:
        1.0
    • Method Detail

      • writeHeader

        public void writeHeader(java.lang.String header,
                                java.lang.String value)
                         throws InvalidRequestException,
                                LengthErrorException
        Usage:
        Add HTTP header information to the response. This is equivalent to CICS API command WEB WRITE.

        Parameters:
        header - contains the name of the HTTP header
        value - contains the value of the named header
        Throws:
        InvalidRequestException - a INVREQ condition occurred
        LengthErrorException - a LENGERR condition occurred
        Since CICS TS version:
        2.3
        Since package version:
        1.0
      • setServerConvert

        public void setServerConvert()
        Usage:
        Sets WEB SEND command option SERVERCONV to SRVCONVERT.

        Since CICS TS version:
        3.1
        Since package version:
        1.0
      • setNoServerConvert

        public void setNoServerConvert()
        Usage:
        Sets WEB SEND command option SERVERCONV to NOSRVCONVERT. This method also clears CHARACTERSET and HOSTCODEPAGE information set by methods setCharacterset() and setHostCodePage().

        Since CICS TS version:
        3.1
        Since package version:
        1.0
      • setClientCodePage

        public void setClientCodePage(java.lang.String characterset)
        Usage:
        Sets WEB SEND command option CHARACTERSET. This method also sets SERVERCONV to SRVCONVERT.

        Parameters:
        characterset - contains the code-page into which the HTTP response body is to be converting when the WEB SEND command is issued
        Since CICS TS version:
        3.1
        Since package version:
        1.0
      • setCharacterset

        public void setCharacterset(java.lang.String characterset)
        Usage:
        Sets WEB SEND command option CHARACTERSET. This method also sets SERVERCONV to SRVCONVERT.

        Parameters:
        characterset - contains the code-page into which the HTTP response body is to be converting when the WEB SEND command is issued
        Since CICS TS version:
        3.2
        Since package version:
        1.100
      • setHostCodePage

        public void setHostCodePage(java.lang.String hostCodePage)
        Usage:
        Sets WEB SEND command option HOSTCODEPAGE. This method also sets SERVERCONV to SRVCONVERT. This option is ignored if methods sendDocument() sendContaner() are used to send a HTTP message.

        Parameters:
        hostCodePage - contains the code-page that the data being sent by the WEB SEND command is encoded in
        Since CICS TS version:
        3.1
        Since package version:
        1.0
      • setMediaType

        public void setMediaType(java.lang.String mediaType)
        Usage:
        Sets WEB SEND command option MEDIATYPE.

        Parameters:
        mediaType - contains mediaType information to be used by the WEB SEND command
        Since CICS TS version:
        3.1
        Since package version:
        1.0
      • setStatus

        public void setStatus(short statusCode,
                              java.lang.String statusText)
        Usage:
        Sets WEB SEND command option STATUSCODE and STATUSTEXT..

        Parameters:
        statusCode - contains a HTTP status code
        statusText - contains text describing the value of the status code
        Since CICS TS version:
        3.1
        Since package version:
        1.0
      • setClose

        public void setClose()
        Usage:
        Sets WEB SEND command option CLOSESTATUS to CLOSE.

        Since CICS TS version:
        3.1
        Since package version:
        1.0
      • setNoClose

        public void setNoClose()
        Usage:
        Sets WEB SEND command option CLOSESTATUS to NOCLOSE.

        Since CICS TS version:
        3.1
        Since package version:
        1.0
      • setActionEventual

        public void setActionEventual()
        Usage:
        Sets WEB SEND command option ACTION to EVENTUAL.

        Since CICS TS version:
        3.1
        Since package version:
        1.0
      • setActionImmediate

        public void setActionImmediate()
        Usage:
        Sets WEB SEND command option ACTION to IMMEDIATE.

        Since CICS TS version:
        3.1
        Since package version:
        1.0
      • setDocDelete

        public void setDocDelete()
        Usage:
        Sets WEB SEND command option DOCSTATUS to DOCDELETE.

        Since CICS TS version:
        3.2
        Since package version:
        1.100
      • setNoDocDelete

        public void setNoDocDelete()
        Usage:
        Sets WEB SEND command option DOCSTATUS to NODOCDELETE.

        Since CICS TS version:
        3.2
        Since package version:
        1.100