public class HttpClientRequest extends API
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, data stored in a container 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.
com.ibm.cics.server.API
for general restrictions on using the JCICS API.
Modifier and Type | Field and Description |
---|---|
static int |
NOTSET
Constant - NOT SET
|
Constructor and Description |
---|
HttpClientRequest(java.lang.String method)
Usage:
The METHOD is saved in the HttpClientRequest object for later use by the send methods. |
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. |
Modifier and Type | Method and Description |
---|---|
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 |
sendContainer(HttpSession session,
Container container)
Usage:
Send data stored in a container to the server. |
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 |
setAuthenticationBasic()
Usage:
Sets WEB SEND SESSTOKEN command option AUTHENTICATE to BASIC.This method also clears any user-name or password information already set by method setAuthenticationBasic(String userName, String password). |
void |
setAuthenticationBasic(java.lang.String userName,
java.lang.String password)
Usage:
Sets WEB SEND SESSTOKEN command option AUTHENTICATE to BASIC and sets the WEB SEND SESSTOKEN command options USERNAME, USERNAMELEN, PASSWORD and PASSWORDLEN. |
void |
setAuthenticationNone()
Usage:
Sets WEB SEND SESSTOKEN command option AUTHENTICATE to NONE. |
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 |
setDocDelete()
Usage:
Sets WEB SEND SESSTOKEN command option DOCSTATUS to DOCDELETE. |
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 |
setNoDocDelete()
Usage:
Sets WEB SEND SESSTOKEN command option DOCSTATUS to NODOCDELETE. |
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. |
public static final int NOTSET
public HttpClientRequest(java.lang.String method)
method
- is the METHOD to be used by the WEB SEND SESSTOKEN commandpublic HttpClientRequest(java.lang.String method, java.lang.String mediaType)
method
- is the METHOD to be used by the WEB SEND SESSTOKEN commandmediaType
- is the MEDIATYPE value to be used by the WEB SEND SESSTOKEN commandpublic void setMethodPost()
public void setMethodGet()
public void setMethodHead()
public void setMethodPut()
public void setMethodTrace()
public void setMethodOptions()
public void setMethodDelete()
public void setCharacterset(java.lang.String characterset)
characterset
- is the CHARACTERSET value to be used by the WEB SEND SESSTOKEN commandpublic void setClose()
public void setNoClose()
public void setActionExpect()
public void setMediaType(java.lang.String mediaType)
mediaType
- contains MEDIATYPE information to be used by the WEB SEND SESSTOKEN commandpublic void setPath(java.lang.String path)
path
- contains PATH information to be used by the WEB SEND SESSTOKEN commandpublic void setUrimap(java.lang.String urimap)
urimap
- contains the URIMAP name to be used by the WEB SEND SESSTOKEN commandpublic void setClientConvert()
public void setNoClientConvert()
public void setQueryString(java.lang.String queryString)
queryString
- contains QUERYSTRING information to be used by the WEB SEND SESSTOKEN commandpublic void setDocDelete()
public void setNoDocDelete()
public void setAuthenticationNone()
public void setAuthenticationBasic()
public void setAuthenticationBasic(java.lang.String userName, java.lang.String password)
userName
- contains the basic authentication user-name.password
- contains the basic authentication password.public void sendDocument(HttpSession session, Document doc) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException
session
- is the HttpSession object associated with the request to be sentdoc
- is the Document object to be sent to the serverInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredIOErrorException
- a IOERR condition occurredNotAuthorisedException
- a NOTAUTH condition occurredLengthErrorException
- a LENGERR condition occurredNotOpenException
- a NOTOPEN condition occurredTokenErrorException
- a TOKENERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendFrom(HttpSession session, java.lang.String from) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException
session
- is the HttpSession object associated with the request to be sentfrom
- is the data to be sent to the serverInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredIOErrorException
- a IOERR condition occurredNotAuthorisedException
- a NOTAUTH condition occurredLengthErrorException
- a LENGERR condition occurredNotOpenException
- a NOTOPEN condition occurredTokenErrorException
- a TOKENERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendFrom(HttpSession session, byte[] from) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException
session
- is the HttpSession object associated with the request to be sentfrom
- is the data to be sent to the serverInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredIOErrorException
- a IOERR condition occurredNotAuthorisedException
- a NOTAUTH condition occurredLengthErrorException
- a LENGERR condition occurredNotOpenException
- a NOTOPEN condition occurredTokenErrorException
- a TOKENERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendContainer(HttpSession session, Container container) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException
session
- is the HttpSession object associated with the request to be sentcontainer
- is the container that holds the data to be sent to the serverInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredIOErrorException
- a IOERR condition occurredNotAuthorisedException
- a NOTAUTH condition occurredLengthErrorException
- a LENGERR condition occurredNotOpenException
- a NOTOPEN condition occurredTokenErrorException
- a TOKENERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void send(HttpSession session) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException
session
- is the HttpSession object associated with the request to be sentInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredIOErrorException
- a IOERR condition occurredNotAuthorisedException
- a NOTAUTH condition occurredLengthErrorException
- a LENGERR condition occurredNotOpenException
- a NOTOPEN condition occurredTokenErrorException
- a TOKENERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendChunk(HttpSession session, java.lang.String from) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException
session
- is the HttpSession object associated with the request to be sentfrom
- is the data to be sent to the serverInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredIOErrorException
- a IOERR condition occurredNotAuthorisedException
- a NOTAUTH condition occurredLengthErrorException
- a LENGERR condition occurredNotOpenException
- a NOTOPEN condition occurredTokenErrorException
- a TOKENERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendChunk(HttpSession session, byte[] from) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException
session
- is the HttpSession object associated with the request to be sentfrom
- is the data to be sent to the serverInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredIOErrorException
- a IOERR condition occurredNotAuthorisedException
- a NOTAUTH condition occurredLengthErrorException
- a LENGERR condition occurredNotOpenException
- a NOTOPEN condition occurredTokenErrorException
- a TOKENERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendLastChunk(HttpSession session) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException
session
- is the HttpSession object associated with the request to be sentInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredIOErrorException
- a IOERR condition occurredNotAuthorisedException
- a NOTAUTH condition occurredLengthErrorException
- a LENGERR condition occurredNotOpenException
- a NOTOPEN condition occurredTokenErrorException
- a TOKENERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void writeHeader(HttpSession session, java.lang.String header, java.lang.String value) throws InvalidRequestException, NotOpenException
session
- is the HttpSession object associated with the request to be sentheader
- contains the name of the HTTP headervalue
- contains the value of the named headerInvalidRequestException
- a INVREQ condition occurredNotOpenException
- a NOTOPEN condition occurred