public class HttpSession extends API
This class provides the Java implementation of HTTP client requests related to the following CICS API commands:
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:
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:
com.ibm.cics.server.API
for general restrictions on using the JCICS API.
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 and Description |
---|
HttpSession(java.lang.String urimap)
Usage:
Sets WEB OPEN command option URIMAP. |
HttpSession(java.lang.String hostName,
java.lang.String scheme)
Usage:
Sets WEB OPEN command option HOST and SCHEME. |
HttpSession(java.lang.String hostName,
java.lang.String scheme,
int portNumber)
Usage:
Sets WEB OPEN command option HOST, SCHEME and PORTNUMBER. |
Modifier and Type | Method and Description |
---|---|
void |
close()
Usage:
Close a session with a host on a remote server. |
java.lang.String |
getCodePage()
Usage:
Returns the codepage that was set using setCodePage(String codePage). |
java.lang.String |
getHost()
Usage:
Obtain this sessions host information. |
int |
getHostType()
Usage:
Obtain this sessions hosttype information. |
int |
getHttpReleaseNumber()
Usage:
Obtain this sessions HTTPRNUM value. |
int |
getHttpVersionNumber()
Usage:
Obtain this sessions HTTPVNUM value. |
java.lang.String |
getPath()
Usage:
Obtain this sessions path information. |
int |
getPortNumber()
Usage:
Obtain this sessions port number. |
java.lang.String |
getScheme()
Usage:
Obtain this sessions scheme information. |
java.lang.String |
getUrimap()
Usage:
Obtain this sessions URIMAP information. |
java.lang.String |
getVersion()
Usage:
Obtain this sessions version information. |
void |
open()
Usage:
Open a session with a host on a remote server. |
void |
open(boolean options)
Usage:
Open a session with a host on a remote server. |
void |
setCertificate(java.lang.String certificate)
Usage:
Sets WEB OPEN command option CERTIFICATE. |
void |
setCiphers(java.lang.String ciphers,
short numberCiphers)
Usage:
Sets WEB OPEN command options CIPHER and NUMCIPHERS. |
void |
setCodePage(java.lang.String codePage)
Usage:
Sets WEB OPEN command option CODEPAGE. |
public static final int NOTSET
public static final int NOTAPPLIC
public static final int IPV4
public static final int IPV6
public static final int HOSTNAME
public HttpSession(java.lang.String urimap)
urimap
- is the name of the URIMAP to be used by the open() methodpublic HttpSession(java.lang.String hostName, java.lang.String scheme)
hostName
- is the name of the HOST to be used by the open() methodscheme
- should either be HTTP or HTTPSpublic HttpSession(java.lang.String hostName, java.lang.String scheme, int portNumber)
hostName
- is the name of the HOST to be used by the open() methodscheme
- should either be HTTP or HTTPSportNumber
- is the value of the PORTNUMBER to be used by the open() methodpublic void setCodePage(java.lang.String codePage)
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.public java.lang.String getCodePage()
public void setCertificate(java.lang.String certificate)
certificate
- is the CERTIFICATE value to be used by the open() methodpublic void setCiphers(java.lang.String ciphers, short numberCiphers)
ciphers
- is the CIPHER value to be used by the open() methodnumberCiphers
- is the NUMCHIPERS value to be used by the open() methodpublic void open() throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, TimedOutException
InvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredIOErrorException
- a IOERR condition occurredNotAuthorisedException
- a NOTAUTH condition occurredLengthErrorException
- a LENGERR condition occurredTimedOutException
- a TIMEDOUT condition occurredpublic void open(boolean options) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, TimedOutException
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.InvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredIOErrorException
- a IOERR condition occurredNotAuthorisedException
- a NOTAUTH condition occurredLengthErrorException
- a LENGERR condition occurredTimedOutException
- a TIMEDOUT condition occurredpublic int getHttpVersionNumber()
public int getHttpReleaseNumber()
public void close() throws InvalidRequestException, NotOpenException
InvalidRequestException
- a INVREQ condition occurredNotOpenException
- a NOTOPEN condition occurredpublic java.lang.String getHost() throws NotOpenException
NotOpenException
- a NOTOPEN condition occurredpublic int getHostType() throws NotOpenException
NotOpenException
- a NOTOPEN condition occurredpublic java.lang.String getPath() throws NotOpenException
NotOpenException
- a NOTOPEN condition occurredpublic java.lang.String getScheme() throws NotOpenException
NotOpenException
- a NOTOPEN condition occurredpublic java.lang.String getVersion() throws NotOpenException
NotOpenException
- a NOTOPEN condition occurredpublic java.lang.String getUrimap() throws NotOpenException
NotOpenException
- a NOTOPEN condition occurredpublic int getPortNumber() throws NotOpenException
NotOpenException
- a NOTOPEN condition occurred