com.ibm.cics.server
Class HttpClientRequest

java.lang.Object
  extended bycom.ibm.cics.server.HttpClientRequest

public class HttpClientRequest
extends java.lang.Object

Usage:
This class provides the Java implementation of HTTP client requests related to the following CICS API commands:

The constructor accepts METHOD and MEDIATYPE information. These values can be altered by setter methods before the send methods are used to send a client request to the server.

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

Various send methods allow a document, an application buffer or a chunked request to be sent to the server.

Method writeHeader() allows the application to supply HTTP headers that will be sent with the client request.


Field Summary
static int NOTSET
           
 
Constructor Summary
HttpClientRequest(java.lang.String method, java.lang.String mediaType)
          Usage:
The METHOD and MEDIATYPE information is saved in the HttpClientRequest object for later use by the send methods.
 
Method Summary
 void send(HttpSession session)
          Usage:
Send an request without a body to the server.
 void sendChunk(HttpSession session, byte[] from)
          Usage:
Send an application buffer to the server as part of a chunked request.
 void sendChunk(HttpSession session, java.lang.String from)
          Usage:
Send an application buffer to the server as part of a chunked request.
 void sendDocument(HttpSession session, Document doc)
          Usage:
Send a document to the server.
 void sendFrom(HttpSession session, byte[] from)
          Usage:
Send an application buffer to the server.
 void sendFrom(HttpSession session, java.lang.String from)
          Usage:
Send an application buffer to the server.
 void sendLastChunk(HttpSession session)
          Usage:
Indicate that the chunked request is complete.
 void setActionExpect()
          Usage:
Sets WEB SEND SESSTOKEN command option ACTION to EXPECT.
 void setCharacterset(java.lang.String characterset)
          Usage:
Sets WEB SEND SESSTOKEN command option CHARACTERSET.
 void setClientConvert()
          Usage:
Sets WEB SEND SESSTOKEN command option CLIENTCONV to CLICONVERT.
 void setClose()
          Usage:
Sets WEB SEND SESSTOKEN command option CLOSESTATUS to CLOSE.
 void setMediaType(java.lang.String mediaType)
          Usage:
Sets WEB SEND SESSTOKEN command option MEDIATYPE.
 void setMethodDelete()
          Usage:
Sets WEB SEND SESSTOKEN command option METHOD to DELETE.
 void setMethodGet()
          Usage:
Sets WEB SEND SESSTOKEN command option METHOD to GET.
 void setMethodHead()
          Usage:
Sets WEB SEND SESSTOKEN command option METHOD to HEAD.
 void setMethodOptions()
          Usage:
Sets WEB SEND SESSTOKEN command option METHOD to OPTIONS.
 void setMethodPost()
          Usage:
Sets WEB SEND SESSTOKEN command option METHOD to POST.
 void setMethodPut()
          Usage:
Sets WEB SEND SESSTOKEN command option METHOD to PUT.
 void setMethodTrace()
          Usage:
Sets WEB SEND SESSTOKEN command option METHOD to TRACE.
 void setNoClientConvert()
          Usage:
Sets WEB SEND SESSTOKEN command option CLIENTCONV to NOCLICONVERT.
 void setNoClose()
          Usage:
Sets WEB SEND SESSTOKEN command option CLOSESTATUS to NOCLOSE.
 void setPath(java.lang.String path)
          Usage:
Sets WEB SEND SESSTOKEN command option PATH.
 void setQueryString(java.lang.String queryString)
          Usage:
Sets WEB SEND SESSTOKEN command option QUERYSTRING.
 void setUrimap(java.lang.String urimap)
          Usage:
Sets WEB SEND SESSTOKEN command option URIMAP.
 void writeHeader(HttpSession session, java.lang.String header, java.lang.String value)
          Usage:
Add HTTP header information to the request This is equivalent to CICS API command WEB WRITE SESSTOKEN.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOTSET

public static final int NOTSET
See Also:
Constant Field Values
Constructor Detail

HttpClientRequest

public HttpClientRequest(java.lang.String method,
                         java.lang.String mediaType)
Usage:
The METHOD and MEDIATYPE information is saved in the HttpClientRequest object for later use by the send methods. Valid methods are "POST", "GET", "HEAD", "PUT", "TRACE", "OPTIONS" and "DELETE". If the method is not one of these or the mediatype is invalid the error is not detected until one of the send methods is used to send the client request to the server.

Parameters:
method - is the METHOD to be used by the WEB SEND SESSTOKEN command
mediaType - is the MEDIATYPE value to be used by the WEB SEND SESSTOKEN command
Throws:
None
Method Detail

setMethodPost

public void setMethodPost()
Usage:
Sets WEB SEND SESSTOKEN command option METHOD to POST.

Returns:
None
Throws:
None

setMethodGet

public void setMethodGet()
Usage:
Sets WEB SEND SESSTOKEN command option METHOD to GET.

Returns:
None
Throws:
None

setMethodHead

public void setMethodHead()
Usage:
Sets WEB SEND SESSTOKEN command option METHOD to HEAD.

Returns:
None
Throws:
None

setMethodPut

public void setMethodPut()
Usage:
Sets WEB SEND SESSTOKEN command option METHOD to PUT.

Returns:
None
Throws:
None

setMethodTrace

public void setMethodTrace()
Usage:
Sets WEB SEND SESSTOKEN command option METHOD to TRACE.

Returns:
None
Throws:
None

setMethodOptions

public void setMethodOptions()
Usage:
Sets WEB SEND SESSTOKEN command option METHOD to OPTIONS.

Returns:
None
Throws:
None

setMethodDelete

public void setMethodDelete()
Usage:
Sets WEB SEND SESSTOKEN command option METHOD to DELETE.

Returns:
None
Throws:
None

setCharacterset

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

Parameters:
characterset - is the CHARACTERSET value to be used by the WEB SEND SESSTOKEN command
Returns:
None
Throws:
None

setClose

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

Returns:
None
Throws:
None

setNoClose

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

Returns:
None
Throws:
None

setActionExpect

public void setActionExpect()
Usage:
Sets WEB SEND SESSTOKEN command option ACTION to EXPECT.

Returns:
None
Throws:
None

setMediaType

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

Parameters:
mediaType - contains MEDIATYPE information to be used by the WEB SEND SESSTOKEN command
Returns:
None
Throws:
None

setPath

public void setPath(java.lang.String path)
Usage:
Sets WEB SEND SESSTOKEN command option PATH.

Parameters:
path - contains PATH information to be used by the WEB SEND SESSTOKEN command
Returns:
None
Throws:
None

setUrimap

public void setUrimap(java.lang.String urimap)
Usage:
Sets WEB SEND SESSTOKEN command option URIMAP.

Parameters:
urimap - contains the URIMAP name to be used by the WEB SEND SESSTOKEN command
Returns:
None
Throws:
None

setClientConvert

public void setClientConvert()
Usage:
Sets WEB SEND SESSTOKEN command option CLIENTCONV to CLICONVERT.

Returns:
None
Throws:
None

setNoClientConvert

public void setNoClientConvert()
Usage:
Sets WEB SEND SESSTOKEN command option CLIENTCONV to NOCLICONVERT. This method also clears CHARACTERSET information set by method setCharacterset().

Returns:
None
Throws:
None

setQueryString

public void setQueryString(java.lang.String queryString)
Usage:
Sets WEB SEND SESSTOKEN command option QUERYSTRING.

Parameters:
queryString - contains QUERYSTRING information to be used by the WEB SEND SESSTOKEN command
Returns:
None
Throws:
None

sendDocument

public void sendDocument(HttpSession session,
                         Document doc)
                  throws InvalidRequestException,
                         RecordNotFoundException,
                         IOErrorException,
                         NotAuthorisedException,
                         LengthErrorException,
                         NotOpenException,
                         TokenErrorException
Usage:
Send a document to the server. This is equivalent to CICS API command WEB SEND SESSTOKEN DOCUMENT. The required command options should have been saved in the HttpClientRequest object before this method is used to send the client request to the server.

Parameters:
session - is the HttpSession object associated with the request to be sent
doc - is the Document object to be sent to the server
Returns:
None
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
NotOpenException - a NOTOPEN condition occurred
TokenErrorException - a TOKENERR condition occurred

sendFrom

public void sendFrom(HttpSession session,
                     java.lang.String from)
              throws InvalidRequestException,
                     RecordNotFoundException,
                     IOErrorException,
                     NotAuthorisedException,
                     LengthErrorException,
                     NotOpenException,
                     TokenErrorException
Usage:
Send an application buffer to the server. This is equivalent to CICS API command WEB SEND SESSTOKEN FROM. The required command options should have been saved in the HttpClientRequest object before this method is used to send the client request to the server.

Parameters:
session - is the HttpSession object associated with the request to be sent
from - is the data to be sent to the server
Returns:
None
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
NotOpenException - a NOTOPEN condition occurred
TokenErrorException - a TOKENERR condition occurred

sendFrom

public void sendFrom(HttpSession session,
                     byte[] from)
              throws InvalidRequestException,
                     RecordNotFoundException,
                     IOErrorException,
                     NotAuthorisedException,
                     LengthErrorException,
                     NotOpenException,
                     TokenErrorException
Usage:
Send an application buffer to the server. This is equivalent to CICS API command WEB SEND SESSTOKEN FROM. The required command options should have been saved in the HttpClientRequest object before this method is used to send the client request to the server.

Parameters:
session - is the HttpSession object associated with the request to be sent
from - is the data to be sent to the server
Returns:
None
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
NotOpenException - a NOTOPEN condition occurred
TokenErrorException - a TOKENERR condition occurred

send

public void send(HttpSession session)
          throws InvalidRequestException,
                 RecordNotFoundException,
                 IOErrorException,
                 NotAuthorisedException,
                 LengthErrorException,
                 NotOpenException,
                 TokenErrorException
Usage:
Send an request without a body to the server. This is equivalent to CICS API command WEB SEND SESSTOKEN. The required command options should have been saved in the HttpClientRequest object before this method is used to send the client request to the server.

Parameters:
session - is the HttpSession object associated with the request to be sent
Returns:
None
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
NotOpenException - a NOTOPEN condition occurred
TokenErrorException - a TOKENERR condition occurred

sendChunk

public void sendChunk(HttpSession session,
                      java.lang.String from)
               throws InvalidRequestException,
                      RecordNotFoundException,
                      IOErrorException,
                      NotAuthorisedException,
                      LengthErrorException,
                      NotOpenException,
                      TokenErrorException
Usage:
Send an application buffer to the server as part of a chunked request. This is equivalent to CICS API command WEB SEND SESSTOKEN FROM CHUNKYES. The required command options should have been saved in the HttpClientRequest object before this method is used to send the client request to the server.

Parameters:
session - is the HttpSession object associated with the request to be sent
from - is the data to be sent to the server
Returns:
None
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
NotOpenException - a NOTOPEN condition occurred
TokenErrorException - a TOKENERR condition occurred

sendChunk

public void sendChunk(HttpSession session,
                      byte[] from)
               throws InvalidRequestException,
                      RecordNotFoundException,
                      IOErrorException,
                      NotAuthorisedException,
                      LengthErrorException,
                      NotOpenException,
                      TokenErrorException
Usage:
Send an application buffer to the server as part of a chunked request. This is equivalent to CICS API command WEB SEND SESSTOKEN FROM CHUNKYES. The required command options should have been saved in the HttpClientRequest object before this method is used to send the client request to the server.

Parameters:
session - is the HttpSession object associated with the request to be sent
from - is the data to be sent to the server
Returns:
None
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
NotOpenException - a NOTOPEN condition occurred
TokenErrorException - a TOKENERR condition occurred

sendLastChunk

public void sendLastChunk(HttpSession session)
                   throws InvalidRequestException,
                          RecordNotFoundException,
                          IOErrorException,
                          NotAuthorisedException,
                          LengthErrorException,
                          NotOpenException,
                          TokenErrorException
Usage:
Indicate that the chunked request is complete. This is equivalent to CICS API command WEB SEND SESSTOKEN CHUNKEND.

Parameters:
session - is the HttpSession object associated with the request to be sent
Returns:
None
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
NotOpenException - a NOTOPEN condition occurred
TokenErrorException - a TOKENERR condition occurred

writeHeader

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

Parameters:
session - is the HttpSession object associated with the request to be sent
header - contains the name of the HTTP header
value - contains the value of the named header
Returns:
None
Throws:
InvalidRequestException - a INVREQ condition occurred
NotOpenException - a NOTOPEN condition occurred