Package com.ibm.cics.server
Class HttpClientRequest
java.lang.Object
com.ibm.cics.server.API
com.ibm.cics.server.HttpClientRequest
This class provides the Java implementation of HTTP client requests related to the following CICS API commands:
- WEB SEND SESSTOKEN
- WEB WRITE SESSTOKEN.
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:
- METHOD
- MEDIATYPE
- CLOSE
- NOCLOSE
- EXPECT
- PATH
- URIMAP
- CLICONVERET
- NOCLICONVERT
- QUERYSTRING
- DOCDELETE
- NODOCDELETE
- AUTHENTICATE NONE
- AUTHENTICATE BASIC
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.
- See Also:
- Since CICS TS version:
- 3.1
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHttpClientRequest(String method) The METHOD is saved in the HttpClientRequest object for later use by the send methods.HttpClientRequest(String method, String mediaType) The METHOD and MEDIATYPE information is saved in the HttpClientRequest object for later use by the send methods. -
Method Summary
Modifier and TypeMethodDescriptionvoidsend(HttpSession session) Send an request without a body to the server.voidsendChunk(HttpSession session, byte[] from) Send an application buffer to the server as part of a chunked request.voidsendChunk(HttpSession session, String from) Send an application buffer to the server as part of a chunked request.voidsendContainer(HttpSession session, Container container) Send data stored in a container to the server.voidsendDocument(HttpSession session, Document doc) Send a document to the server.voidsendFrom(HttpSession session, byte[] from) Send an application buffer to the server.voidsendFrom(HttpSession session, String from) Send an application buffer to the server.voidsendLastChunk(HttpSession session) Indicate that the chunked request is complete.voidSets WEB SEND SESSTOKEN command option ACTION to EXPECT.voidSets 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).voidsetAuthenticationBasic(String userName, String password) Sets WEB SEND SESSTOKEN command option AUTHENTICATE to BASIC and sets the WEB SEND SESSTOKEN command options USERNAME, USERNAMELEN, PASSWORD and PASSWORDLEN.voidSets WEB SEND SESSTOKEN command option AUTHENTICATE to NONE.voidsetCharacterset(String characterset) Sets WEB SEND SESSTOKEN command option CHARACTERSET.voidSets WEB SEND SESSTOKEN command option CLIENTCONV to CLICONVERT.voidsetClose()Sets WEB SEND SESSTOKEN command option CLOSESTATUS to CLOSE.voidSets WEB SEND SESSTOKEN command option DOCSTATUS to DOCDELETE.voidsetMediaType(String mediaType) Sets WEB SEND SESSTOKEN command option MEDIATYPE.voidSets WEB SEND SESSTOKEN command option METHOD to DELETE.voidSets WEB SEND SESSTOKEN command option METHOD to GET.voidSets WEB SEND SESSTOKEN command option METHOD to HEAD.voidSets WEB SEND SESSTOKEN command option METHOD to OPTIONS.voidSets WEB SEND SESSTOKEN command option METHOD to PATCH.voidSets WEB SEND SESSTOKEN command option METHOD to POST.voidSets WEB SEND SESSTOKEN command option METHOD to PUT.voidSets WEB SEND SESSTOKEN command option METHOD to TRACE.voidSets WEB SEND SESSTOKEN command option CLIENTCONV to NOCLICONVERT.voidSets WEB SEND SESSTOKEN command option CLOSESTATUS to NOCLOSE.voidSets WEB SEND SESSTOKEN command option DOCSTATUS to NODOCDELETE.voidSets WEB SEND SESSTOKEN command option PATH.voidsetQueryString(String queryString) Sets WEB SEND SESSTOKEN command option QUERYSTRING.voidSets WEB SEND SESSTOKEN command option URIMAP.voidwriteHeader(HttpSession session, String header, String value) Add HTTP header information to the request This is equivalent to CICS API command WEB WRITE SESSTOKEN.Methods inherited from class com.ibm.cics.server.API
getCICSServerApiVersion
-
Field Details
-
NOTSET
public static final int NOTSETConstant - NOT SET- Since CICS TS version:
- 3.1
-
-
Constructor Details
-
HttpClientRequest
The METHOD is saved in the HttpClientRequest object for later use by the send methods. Valid methods are "POST", "GET", "HEAD", "PUT", "TRACE", "OPTIONS", "PATCH" 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- Since CICS TS version:
- 4.1
-
HttpClientRequest
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", "PATCH" 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 commandmediaType- is the MEDIATYPE value to be used by the WEB SEND SESSTOKEN command- Since CICS TS version:
- 3.1
-
-
Method Details
-
setMethodPost
public void setMethodPost()Sets WEB SEND SESSTOKEN command option METHOD to POST.- Since CICS TS version:
- 3.1
-
setMethodGet
public void setMethodGet()Sets WEB SEND SESSTOKEN command option METHOD to GET.- Since CICS TS version:
- 3.1
-
setMethodHead
public void setMethodHead()Sets WEB SEND SESSTOKEN command option METHOD to HEAD.- Since CICS TS version:
- 3.1
-
setMethodPut
public void setMethodPut()Sets WEB SEND SESSTOKEN command option METHOD to PUT.- Since CICS TS version:
- 3.1
-
setMethodTrace
public void setMethodTrace()Sets WEB SEND SESSTOKEN command option METHOD to TRACE.- Since CICS TS version:
- 3.1
-
setMethodOptions
public void setMethodOptions()Sets WEB SEND SESSTOKEN command option METHOD to OPTIONS.- Since CICS TS version:
- 3.1
-
setMethodDelete
public void setMethodDelete()Sets WEB SEND SESSTOKEN command option METHOD to DELETE.- Since CICS TS version:
- 3.1
-
setMethodPatch
public void setMethodPatch()Sets WEB SEND SESSTOKEN command option METHOD to PATCH.- Since CICS TS version:
- 6.2
-
setCharacterset
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- Since CICS TS version:
- 3.1
-
setClose
public void setClose()Sets WEB SEND SESSTOKEN command option CLOSESTATUS to CLOSE.- Since CICS TS version:
- 3.1
-
setNoClose
public void setNoClose()Sets WEB SEND SESSTOKEN command option CLOSESTATUS to NOCLOSE.- Since CICS TS version:
- 3.1
-
setActionExpect
public void setActionExpect()Sets WEB SEND SESSTOKEN command option ACTION to EXPECT.- Since CICS TS version:
- 3.1
-
setMediaType
Sets WEB SEND SESSTOKEN command option MEDIATYPE.- Parameters:
mediaType- contains MEDIATYPE information to be used by the WEB SEND SESSTOKEN command- Since CICS TS version:
- 3.1
-
setPath
Sets WEB SEND SESSTOKEN command option PATH.- Parameters:
path- contains PATH information to be used by the WEB SEND SESSTOKEN command- Since CICS TS version:
- 3.1
-
setUrimap
Sets WEB SEND SESSTOKEN command option URIMAP.- Parameters:
urimap- contains the URIMAP name to be used by the WEB SEND SESSTOKEN command- Since CICS TS version:
- 3.1
-
setClientConvert
public void setClientConvert()Sets WEB SEND SESSTOKEN command option CLIENTCONV to CLICONVERT.- Since CICS TS version:
- 3.1
-
setNoClientConvert
public void setNoClientConvert()Sets WEB SEND SESSTOKEN command option CLIENTCONV to NOCLICONVERT. This method also clears CHARACTERSET information set by method setCharacterset().- Since CICS TS version:
- 3.1
-
setQueryString
Sets WEB SEND SESSTOKEN command option QUERYSTRING.- Parameters:
queryString- contains QUERYSTRING information to be used by the WEB SEND SESSTOKEN command- Since CICS TS version:
- 3.1
-
setDocDelete
public void setDocDelete()Sets WEB SEND SESSTOKEN command option DOCSTATUS to DOCDELETE.- Since CICS TS version:
- 3.2
-
setNoDocDelete
public void setNoDocDelete()Sets WEB SEND SESSTOKEN command option DOCSTATUS to NODOCDELETE.- Since CICS TS version:
- 3.2
-
setAuthenticationNone
public void setAuthenticationNone()Sets WEB SEND SESSTOKEN command option AUTHENTICATE to NONE. This method also clears any user-name or password information already set by method setAuthenticationBasic(String userName, String password).- Since CICS TS version:
- 3.2
-
setAuthenticationBasic
public void setAuthenticationBasic()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). This causes CICS global exit XWBAUTH to be driven to provide the user-name and password information when the WEB SEND SESSTOKEN command is issued by one of the send methods.- Since CICS TS version:
- 3.2
-
setAuthenticationBasic
Sets WEB SEND SESSTOKEN command option AUTHENTICATE to BASIC and sets the WEB SEND SESSTOKEN command options USERNAME, USERNAMELEN, PASSWORD and PASSWORDLEN.- Parameters:
userName- contains the basic authentication user-name.password- contains the basic authentication password.- Since CICS TS version:
- 3.2
-
sendDocument
public void sendDocument(HttpSession session, Document doc) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException 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 sentdoc- is the Document object to be sent to the server- Throws:
InvalidRequestException- 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 occurred- Since CICS TS version:
- 3.1
-
sendFrom
public void sendFrom(HttpSession session, String from) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException 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 sentfrom- is the data to be sent to the server- Throws:
InvalidRequestException- 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 occurred- Since CICS TS version:
- 3.1
-
sendFrom
public void sendFrom(HttpSession session, byte[] from) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException 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 sentfrom- is the data to be sent to the server- Throws:
InvalidRequestException- 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 occurred- Since CICS TS version:
- 3.1
-
sendContainer
public void sendContainer(HttpSession session, Container container) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException Send data stored in a container to the server. This is equivalent to CICS API command WEB SEND SESSTOKEN CONTAINER. 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 sentcontainer- is the container that holds the data to be sent to the server- Throws:
InvalidRequestException- 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 occurred- Since CICS TS version:
- 3.2
-
send
public void send(HttpSession session) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException 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- Throws:
InvalidRequestException- 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 occurred- Since CICS TS version:
- 3.1
-
sendChunk
public void sendChunk(HttpSession session, String from) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException 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. Once the first chunk has been sent the instance variables set in the HttpClientRequest object by the setter methods are reset- Parameters:
session- is the HttpSession object associated with the request to be sentfrom- is the data to be sent to the server- Throws:
InvalidRequestException- 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 occurred- Since CICS TS version:
- 3.1
-
sendChunk
public void sendChunk(HttpSession session, byte[] from) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException 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. Once the first chunk has been sent the instance variables set in the HttpClientRequest object by the setter methods are reset.- Parameters:
session- is the HttpSession object associated with the request to be sentfrom- is the data to be sent to the server- Throws:
InvalidRequestException- 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 occurred- Since CICS TS version:
- 3.1
-
sendLastChunk
public void sendLastChunk(HttpSession session) throws InvalidRequestException, RecordNotFoundException, IOErrorException, NotAuthorisedException, LengthErrorException, NotOpenException, TokenErrorException, ContainerErrorException, ChannelErrorException 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- Throws:
InvalidRequestException- 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 occurred- Since CICS TS version:
- 3.1
-
writeHeader
public void writeHeader(HttpSession session, String header, String value) throws InvalidRequestException, NotOpenException 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 sentheader- contains the name of the HTTP headervalue- contains the value of the named header- Throws:
InvalidRequestException- a INVREQ condition occurredNotOpenException- a NOTOPEN condition occurred- Since CICS TS version:
- 3.1
-