com.ibm.cics.server

Class HttpSession



  • public class HttpSession
    extends API
    This class provides the Java implementation of HTTP client requests related to the following CICS API commands:
    • WEB OPEN
    • WEB CLOSE
    • WEB EXTRACT SESSTOKEN.

    The constructors accept either a URIMAP or a HOST string, SCHEME string and the optional PORTNUMBER value as parameters.

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

    • CERTIFICATE
    • CODEPAGE
    • CIPHERS
    • NUMCIPHERS

    Method open() opens a session with a host on a remote server. The method uses the values set in the HttpSession constructor and any optional values set by the setters to open the session. This is equivalent to CICS API command WEB OPEN.

    Method close() closes the session with the host on the remote server. This is equivalent to CICS API command WEB CLOSE.

    If the client session has successfully been opened by the open() method getter methods can be used to obtain the following information about the open session that was saved when the session was opened or was obtained using the CICS API command WEB EXTRACT SESSTOKEN:

    • HTTPVNUM
    • HTTPRNUM
    • PATH
    • HOST
    • VERSION
    • SCHEME
    • URIMAP
    • PORTNUMBER
    • SESSTOKEN
    • HOSTTYPE
    See Also:
    com.ibm.cics.server.API for general restrictions on using the JCICS API.
    Since CICS TS version:
    3.1
    Since package version:
    1.0.0
    • Field Summary

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

      Constructors 
      Constructor and Description
      HttpSession(java.lang.String urimap)
      Sets WEB OPEN command option URIMAP.
      HttpSession(java.lang.String hostName, java.lang.String schemeName)
      Sets WEB OPEN command option HOST and SCHEME.
      HttpSession(java.lang.String hostName, java.lang.String schemeName, int portNumber)
      Sets WEB OPEN command option HOST, SCHEME and PORTNUMBER.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void close()
      Close a session with a host on a remote server.
      java.lang.String getCodePage()
      Returns the codepage that was set using setCodePage(String codePage).
      java.lang.String getHost()
      Obtain this sessions host information.
      int getHostType()
      Obtain this sessions hosttype information.
      int getHttpReleaseNumber()
      Obtain this sessions HTTPRNUM value.
      int getHttpVersionNumber()
      Obtain this sessions HTTPVNUM value.
      java.lang.String getPath()
      Obtain this sessions path information.
      int getPortNumber()
      Obtain this sessions port number.
      java.lang.String getScheme()
      Obtain this sessions scheme information.
      java.lang.String getUrimap()
      Obtain this sessions URIMAP information.
      java.lang.String getVersion()
      Obtain this sessions version information.
      void open()
      Open a session with a host on a remote server.
      void open(boolean options)
      Open a session with a host on a remote server.
      void setCertificate(java.lang.String certificate)
      Sets WEB OPEN command option CERTIFICATE.
      void setCiphers(java.lang.String ciphers, short numberCiphers)
      Sets WEB OPEN command options CIPHER and NUMCIPHERS.
      void setCodePage(java.lang.String codePage)
      Sets WEB OPEN command option CODEPAGE.
      • 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
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • NOTAPPLIC

        public static final int NOTAPPLIC
        Constant - NOTAPPLIC
        Since CICS TS version:
        4.1
        Since package version:
        1.200.0
      • IPV4

        public static final int IPV4
        Constant - IPV4
        Since CICS TS version:
        4.1
        Since package version:
        1.200.0
      • IPV6

        public static final int IPV6
        Constant - IPV6
        Since CICS TS version:
        4.1
        Since package version:
        1.200.0
      • HOSTNAME

        public static final int HOSTNAME
        Constant - HOSTNAME
        Since CICS TS version:
        4.1
        Since package version:
        1.200.0
    • Constructor Detail

      • HttpSession

        public HttpSession(java.lang.String urimap)
        Sets WEB OPEN command option URIMAP.
        Parameters:
        urimap - is the name of the URIMAP to be used by the open() method
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • HttpSession

        public HttpSession(java.lang.String hostName,
                           java.lang.String schemeName)
        Sets WEB OPEN command option HOST and SCHEME.
        Parameters:
        hostName - is the name of the HOST to be used by the open() method
        schemeName - should either be HTTP or HTTPS
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • HttpSession

        public HttpSession(java.lang.String hostName,
                           java.lang.String schemeName,
                           int portNumber)
        Sets WEB OPEN command option HOST, SCHEME and PORTNUMBER.
        Parameters:
        hostName - is the name of the HOST to be used by the open() method
        schemeName - should either be HTTP or HTTPS
        portNumber - is the value of the PORTNUMBER to be used by the open() method
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
    • Method Detail

      • setCodePage

        public void setCodePage(java.lang.String codePage)
        Sets WEB OPEN command option CODEPAGE.
        Parameters:
        codePage - is the code page to be used by the open() method This method will only take effect if it is called before the HttpSession.open() method is called. This is the encoding in which text data is passed between the application and CICS.
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • getCodePage

        public java.lang.String getCodePage()
        Returns the codepage that was set using setCodePage(String codePage).

        Returns:
        the codepage for the connection, or null if no codepage is set
        Since CICS TS version:
        5.1
        Since package version:
        1.401.0
      • setCertificate

        public void setCertificate(java.lang.String certificate)
        Sets WEB OPEN command option CERTIFICATE.
        Parameters:
        certificate - is the CERTIFICATE value to be used by the open() method
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • setCiphers

        public void setCiphers(java.lang.String ciphers,
                               short numberCiphers)
        Sets WEB OPEN command options CIPHER and NUMCIPHERS.
        Parameters:
        ciphers - is the CIPHER value to be used by the open() method
        numberCiphers - is the NUMCHIPERS value to be used by the open() method
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • open

        public void open(boolean options)
                  throws InvalidRequestException,
                         RecordNotFoundException,
                         IOErrorException,
                         NotAuthorisedException,
                         LengthErrorException,
                         TimedOutException

        Open a session with a host on a remote server. This is equivalent to the CICS API command WEB OPEN with the option of whether to query the HttpVersionNumber and HttpReleaseNumber of the server.

        The HttpSession constructor has saved the basic HttpSession values in the HttpSession object and any additional optional values should have been saved using the setter methods of this object before this method is used to open the session.

        Parameters:
        options - The options parameter determines whether CICS should flow an http OPTIONS query to the remote server to determine the HttpVersionNumber and HttpReleaseNumber, prior to opening the connection. If the options parameter is set to false, the OPTIONS request is not sent and the methods HttpSession.getHttpVersionNumber and HttpSession.getHttpReleaseNumber will always return a NOTSET value.
        Throws:
        InvalidRequestException - a INVREQ condition occurred
        RecordNotFoundException - a NOTFND condition occurred
        IOErrorException - a IOERR condition occurred
        NotAuthorisedException - a NOTAUTH condition occurred
        LengthErrorException - a LENGERR condition occurred
        TimedOutException - a a TIMEDOUT condition occurred
        Since CICS TS version:
        4.2
        Since package version:
        1.0.0
      • getHttpVersionNumber

        public int getHttpVersionNumber()
        Obtain this sessions HTTPVNUM value. This value is only available after method open() has successfully opened the session. If this method is invoked before method open() or after method close() a NOTSET value will be returned.
        Returns:
        The HTTPVNUM value returned by the CICS API command WEB OPEN
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • getHttpReleaseNumber

        public int getHttpReleaseNumber()
        Obtain this sessions HTTPRNUM value. This value is only available after method open() has successfully opened the session. If this method is invoked before method open() or after method close() a NOTSET value will be returned.
        Returns:
        The HTTPRNUM value returned by the CICS API command WEB OPEN
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • getHost

        public java.lang.String getHost()
                                 throws NotOpenException
        Obtain this sessions host information. This is equivalent to CICS API command WEB EXTRACT SESSTOKEN HOST.
        Returns:
        Host information returned by CICS API command WEB EXTRACT SESSTOKEN HOST
        Throws:
        NotOpenException - a NOTOPEN condition occurred
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • getHostType

        public int getHostType()
                        throws NotOpenException
        Obtain this sessions hosttype information. This is equivalent to CICS API command WEB EXTRACT SESSTOKEN HOSTTYPE.
        Returns:
        Host information returned by CICS API command WEB EXTRACT SESSTOKEN HOSTTYPE
        Throws:
        NotOpenException - a NOTOPEN condition occurred
        Since CICS TS version:
        4.1
        Since package version:
        1.200.0
      • getPath

        public java.lang.String getPath()
                                 throws NotOpenException
        Obtain this sessions path information. This is equivalent to CICS API command WEB EXTRACT SESSTOKEN PATH.
        Returns:
        Path information returned by CICS API command WEB EXTRACT SESSTOKEN PATH
        Throws:
        NotOpenException - a NOTOPEN condition occurred
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • getScheme

        public java.lang.String getScheme()
                                   throws NotOpenException
        Obtain this sessions scheme information. This is equivalent to CICS API command WEB EXTRACT SESSTOKEN SCHEME.
        Returns:
        Scheme information returned by CICS API command WEB EXTRACT SESSTOKEN SCHEME
        Throws:
        NotOpenException - a NOTOPEN condition occurred
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • getVersion

        public java.lang.String getVersion()
                                    throws NotOpenException
        Obtain this sessions version information. This is equivalent to CICS API command WEB EXTRACT SESSTOKEN VERSION.
        Returns:
        Version information returned by CICS API command WEB EXTRACT SESSTOKEN VERSION
        Throws:
        NotOpenException - a NOTOPEN condition occurred
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • getUrimap

        public java.lang.String getUrimap()
                                   throws NotOpenException
        Obtain this sessions URIMAP information. This is equivalent to CICS API command WEB EXTRACT SESSTOKEN URIMAP.
        Returns:
        URIMAP information returned by CICS API command WEB EXTRACT SESSTOKEN URIMAP
        Throws:
        NotOpenException - a NOTOPEN condition occurred
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0
      • getPortNumber

        public int getPortNumber()
                          throws NotOpenException
        Obtain this sessions port number. This is equivalent to CICS API command WEB EXTRACT SESSTOKEN PORTNUMBER.
        Returns:
        portNumber information returned by CICS API command WEB EXTRACT SESSTOKEN PORTNUMBER
        Throws:
        NotOpenException - a NOTOPEN condition occurred
        Since CICS TS version:
        3.1
        Since package version:
        1.0.0