public class HttpRequest extends TcpipRequest
This class provides the Java implementation of HTTP requests related to the following CICS API WEB server commands:
This class extends class TcpipRequest so the TcpipRequest class related CICS API commands, listed below, are also available.
This class is a singleton class. The constructor is private and class method getHttpRequestInstance() has to be used to obtain the HttpRequest object.
The getHttpHeader() method returns the named HTTP header value. This is equivalent to CICS API command WEB READ HTTPHEADER.
The getFormField() method returns the named HTML form field value. This is equivalent to CICS API command WEB READ FORMFIELD.
The getQueryParm() method returns the named keyword value of a name/value pair. This is equivalent to CICS API command WEB READ QUERYPARM.
The startBrowseHeader() method signals the start of a browse of the HTTP headers, getNextHeader() method is used to browse the HTTP headers and endBrowseHeader() signals the termination of the browse. These are equivalent to CICS API commands WEB STARTBROWSE HTTPHEADER, WEB READNEXT HTTPHEADER and WEB ENDBROWSE HTTPHEADER.
The startBrowseFormField() method signals the start of a browse of the HTTP form fields, getNextFormField() method is used to browse the form fields and endBrowseFormField() method signals the termination of the browse. These are equivalent to CICS API commands WEB STARTBROWSE FORMFIELD, WEB READNEXT FORMFIELD and WEB ENDBROWSE FORMFIELD.
The startBrowseQueryParm() method signals the start of a browse of the keyword parameters, getNextQueryParm() method is used to browse the keyword parameters and endBrowseQueryParm() method signals the termination of the browse. These are equivalent to CICS API commands WEB STARTBROWSE QUERYPARM, WEB READNEXT QUERYPARM and WEB ENDBROWSE QUERYPARM.
The setter methods allow instance variables to be set in the HttpRequest object. These variables relate to the following options on the CICS API command WEB RECEIVE:
By default MAXLENGTH is set to 32K and NOTRUNCATE is not set. These values can be overridden by the setters.
Method getContent() will receive the clients request body. This is equivalent to CICS API command WEB RECEIVE INTO.
Depending on the size of the body sent by the client and the MAXLENGTH value the complete body may not be received. Method isBodyComplete() returns boolean true if the whole body was returned by the getContent() method. If the whole body was not returned by getContent() then isBodyTruncated() returns boolean true unless setNoTruncate() was used to specify NOTRUNCATE. If NOTRUNCATE was specified and the complete body was not returned by getContent() then isBodyPartial() returns boolean true and getContent() can be used to obtain the next portion of the body.
The HTTP body can also be received into a named container using method getContentAsContainer(). If the HTTP body is received into a named container any instance variables set by the setter methods are ignored with the exception of CHARACTERSET.
The getter methods return the various CICS API command WEB EXTRACT values and the mediaType and character-set of the HTTP body sent by the client.
The isDataHttp() method returns a boolean which indicates the request type from the CICS API command WEB EXTRACT.
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
|
AUTOAUTH, AUTOREGISTER, BASICAUTH, CERTIFICAUTH, CLIENTAUTH, IPV4, IPV6, NOAUTHENTIC, NOSSL, NOTAPPLIC, NOTSUPPORTED, REQUIRED, SSL, SUPPORTED
Modifier and Type | Method and Description |
---|---|
void |
drive_ibmJVMTidyUp()
Call the ibmJVMTidyUp method from a non-resettable JVM
|
void |
endBrowseFormField()
Usage:
Signal the end of the form field browse. |
void |
endBrowseHeader()
Usage:
Signal the end of the HTTP header browse. |
void |
endBrowseQueryParm()
Usage:
Signal the end of the queryparm browse. |
java.lang.String |
getBodyCharset()
Usage:
Returns the HTTP body character-set in which the HTTP body was encoded in by the client. |
byte[] |
getContent()
Usage:
Returns the body of the HTTP request. |
byte[] |
getContent(java.lang.String hostCodePage,
java.lang.String characterset)
Usage:
Returns the body of the HTTP request. |
Container |
getContentAsContainer(java.lang.String toContainer)
Usage:
Stores the body of the HTTP request in a named container. |
Container |
getContentAsContainer(java.lang.String toContainer,
java.lang.String toChannel)
Usage:
Stores the body of the HTTP request in a named container. |
java.lang.String |
getFormField(java.lang.String formField)
Usage:
Returns the value of a field from the HTML form. |
java.lang.String |
getFormField(java.lang.String formField,
java.lang.String hostCodePage,
java.lang.String characterset)
Usage:
Returns the value of a field from the HTML form. |
byte[] |
getFormFieldData(java.lang.String formField)
Usage:
Returns the value of a field from the HTML form. |
byte[] |
getFormFieldData(java.lang.String formField,
java.lang.String hostCodePage,
java.lang.String characterset)
Usage:
Returns the value of a field from the HTML form. |
java.lang.String |
getHeader(java.lang.String header)
Usage:
Returns the contents of a HTTP header. |
java.lang.String |
getHost()
Usage:
Returns the host string from the HTTP request. |
int |
getHostType()
Usage:
Returns the host type from the HTTP request. |
java.lang.String |
getHttpMethod()
Usage:
Returns the HTTP method string on the request line of the in-bound message. |
static HttpRequest |
getHttpRequestInstance()
Usage:
Class method that returns the HttpRequest object. |
java.lang.String |
getHttpVersion()
Usage:
Returns the HTTP version string on the request line of the in-bound message. |
java.lang.String |
getMediaType()
Usage:
Returns the media type of the HTTP body sent by the client. |
FormField |
getNextFormField()
Usage:
Returns the next name-value pair from the HTML form to be browsed. |
HttpHeader |
getNextHeader()
Usage:
Returns the next HTTP header name-value pair to be browsed. |
QueryParm |
getNextQueryParm()
Usage:
Returns the next keyword parameter from the URL to be browsed. |
java.lang.String |
getPath()
Usage:
Returns the PATH specified in the request line on the in-bound message. |
int |
getPortNumber()
Usage:
Returns the port number associated with the HTTP request. |
java.lang.String |
getQueryParm(java.lang.String queryParm)
Usage:
Reads a keyword parameter, consisting of a name and value pair, from a query string in a URL, and returns it. |
java.lang.String |
getQueryString()
Usage:
Returns the query string on the request line of the HTTP request. |
java.lang.String |
getRequestType()
Usage:
Returns the type of request received, either HTTPYES or HTTPNO. |
java.lang.String |
getScheme()
Usage:
Returns the scheme from the HTTP request. |
java.lang.String |
getUrimap()
Usage:
Returns the URIMAP associated with the HTTP request. |
boolean |
isBodyComplete()
Usage:
Returns a boolean which indicates whether the body returned by getContent() was completely returned or the last portion of the body was returned by the last getContent() call. |
boolean |
isBodyPartial()
Usage:
Returns a boolean which indicates whether the body returned by getContent() was a partial body or not. |
boolean |
isBodyTruncated()
Usage:
Returns a boolean which indicates whether the body returned by getContent() was truncated or not. |
boolean |
isDataHttp()
Usage:
Returns a boolean which indicates the request type. |
boolean |
isSchemeHttp()
Usage:
Returns a boolean which indicates if the scheme is HTTP or not. |
boolean |
isSchemeHttps()
Usage:
Returns a boolean which indicates if the scheme is HTTPS or not. |
void |
setCharacterset(java.lang.String characterset)
Usage:
Sets WEB RECEIVE command option CHARACTERSET. |
void |
setClientCodePage(java.lang.String characterset)
Usage:
Sets WEB RECEIVE command option CHARACTERSET. |
void |
setHostCodePage(java.lang.String hostCodePage)
Usage:
Sets WEB RECEIVE command option HOSTCODEPAGE. |
void |
setMaxLength(int maxLength)
Usage:
Sets WEB RECEIVE command option MAXLENGTH. |
void |
setNoServerConvert()
Usage:
Sets WEB RECEIVE command option SERVERCONV to NOSRVCONVERT. |
void |
setNoTruncate()
Usage:
Sets WEB RECEIVE command option NOTRUNCATE. |
void |
setServerConvert()
Usage:
Sets WEB RECEIVE command option SERVERCONV to SRVCONVERT. |
void |
setTruncate()
Usage:
Resets WEB RECEIVE command option NOTRUNCATE. |
void |
startBrowseFormField()
Usage:
Signal the start of HTML form field browse from the first name-value pair. |
void |
startBrowseFormField(java.lang.String name)
Usage:
Signal the start of HTML form field browse from a specific name-value pair. |
void |
startBrowseFormField(java.lang.String name,
java.lang.String hostCodePage,
java.lang.String characterset)
Usage:
Signal the start of HTML form field browse from a specific name-value pair. |
void |
startBrowseHeader()
Usage:
Signal the start of a browse of the HTTP headers from the first name-value pair. |
void |
startBrowseQueryParm()
Usage:
Signal the start of HTML queryparm browse from the first name-value pair. |
void |
startBrowseQueryParm(java.lang.String name)
Usage:
Signal the start of HTML queryparm browse from a specific name-value pair. |
getAuthenticate, getCertificateInfo, getCertificateInfo, getClientAddress, getClientHostAddress, getClientHostAddress6, getClientHostName, getClientIpFamily, getMaxDataLen, getPrivacy, getServerAddress, getServerHostAddress, getServerHostAddress6, getServerHostName, getServerIpFamily, getTcpipRequestInstance, getTcpipService, isClientAuth, isSSL
public static final int NOTSET
public static HttpRequest getHttpRequestInstance()
public java.lang.String getHttpMethod() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic java.lang.String getHttpVersion() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic java.lang.String getRequestType() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic boolean isDataHttp() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic java.lang.String getPath() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic java.lang.String getQueryString() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic java.lang.String getHost() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic int getHostType() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic boolean isSchemeHttp() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic boolean isSchemeHttps() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic java.lang.String getScheme() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic java.lang.String getUrimap() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic int getPortNumber() throws InvalidRequestException
getPortNumber
in class TcpipRequest
InvalidRequestException
- a INVREQ condition occurredpublic java.lang.String getHeader(java.lang.String header) throws InvalidRequestException
header
- contains the name of the HTTP headerInvalidRequestException
- a INVREQ condition occurredpublic java.lang.String getFormField(java.lang.String formField) throws InvalidRequestException
formField
- contains the name of the form fieldInvalidRequestException
- a INVREQ condition occurredpublic java.lang.String getFormField(java.lang.String formField, java.lang.String hostCodePage, java.lang.String characterset) throws InvalidRequestException
formField
- contains the name of the form fieldhostCodePage
- contains the host code-page to be used when the forms data
is converted from the ASCII code-page it was received in, into the
EBCDIC code-page in which CICS will process itcharacterset
- contains the code-page in which the form is encodedInvalidRequestException
- a INVREQ condition occurredpublic byte[] getFormFieldData(java.lang.String formField) throws InvalidRequestException
formField
- contains the name of the form fieldInvalidRequestException
- a INVREQ condition occurredpublic byte[] getFormFieldData(java.lang.String formField, java.lang.String hostCodePage, java.lang.String characterset) throws InvalidRequestException
formField
- contains the name of the form fieldhostCodePage
- contains the host code-page to be used when the forms data
is converted from the ASCII code-page it was received in, into the
EBCDIC code-page in which CICS will process itcharacterset
- contains the code-page in which the form is encodedInvalidRequestException
- a INVREQ condition occurredpublic java.lang.String getQueryParm(java.lang.String queryParm) throws InvalidRequestException
queryParm
- contains the name of the query parameter
to readInvalidRequestException
- a INVREQ condition occurredpublic void setServerConvert()
setServerConvert
in class TcpipRequest
public void setNoServerConvert()
setNoServerConvert
in class TcpipRequest
public void setClientCodePage(java.lang.String characterset)
setClientCodePage
in class TcpipRequest
characterset
- contains the code-page of the HTTP requests body.public void setCharacterset(java.lang.String characterset)
setCharacterset
in class TcpipRequest
characterset
- contains the code-page of the HTTP requests body.public void setHostCodePage(java.lang.String hostCodePage)
setHostCodePage
in class TcpipRequest
hostCodePage
- contains the code-page that the HTTP requests body will be converted into.public void setNoTruncate()
setNoTruncate
in class TcpipRequest
public void setTruncate()
setTruncate
in class TcpipRequest
public void setMaxLength(int maxLength) throws LengthErrorException
setMaxLength
in class TcpipRequest
maxLength
- contains the maximum length valueLengthErrorException
- if maxLength is less than 1public byte[] getContent(java.lang.String hostCodePage, java.lang.String characterset) throws InvalidRequestException, RecordNotFoundException, NonHttpDataException
getContent
in class TcpipRequest
hostCodePage
- contains the host code-page to be used when the body
is converted from the ASCII code-page it was received in, into the
EBCDIC code-page in which CICS will process itcharacterset
- contains the code-page in which the HTTP body is encodedInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredNonHttpDataException
- WEB RECEIVE data is of type HTTPNOpublic byte[] getContent() throws InvalidRequestException, RecordNotFoundException, NonHttpDataException
getContent
in class TcpipRequest
InvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredNonHttpDataException
- WEB RECEIVE data is of type HTTPNOpublic Container getContentAsContainer(java.lang.String toContainer, java.lang.String toChannel) throws InvalidRequestException, RecordNotFoundException, ChannelErrorException, ContainerErrorException
getContentAsContainer
in class TcpipRequest
toContainer
- is the name of the container into which the HTTP body is to be storedtoChannel
- is the name of the channel that owns the containerInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredChannelErrorException
- a CHANNELERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredpublic Container getContentAsContainer(java.lang.String toContainer) throws InvalidRequestException, RecordNotFoundException, ChannelErrorException, ContainerErrorException
getContentAsContainer
in class TcpipRequest
toContainer
- is the name of the container into which the HTTP body is to be storedInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredChannelErrorException
- a CHANNELERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredpublic boolean isBodyComplete()
isBodyComplete
in class TcpipRequest
public boolean isBodyTruncated()
isBodyTruncated
in class TcpipRequest
public boolean isBodyPartial()
isBodyPartial
in class TcpipRequest
public java.lang.String getBodyCharset() throws InvalidRequestException
getBodyCharset
in class TcpipRequest
InvalidRequestException
- a INVREQ condition occurredpublic java.lang.String getMediaType() throws InvalidRequestException
getMediaType
in class TcpipRequest
InvalidRequestException
- a INVREQ condition occurredpublic void startBrowseHeader() throws InvalidRequestException, RecordNotFoundException, LogicException
InvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLogicException
- a ILLOGIC condition occurredpublic HttpHeader getNextHeader() throws InvalidRequestException, EndOfFileException
InvalidRequestException
- a INVREQ condition occurredEndOfFileException
- a ENDFILE condition occurredpublic void endBrowseHeader() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic void startBrowseFormField() throws InvalidRequestException, RecordNotFoundException, LogicException
InvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLogicException
- a ILLOGIC condition occurredpublic void startBrowseFormField(java.lang.String name) throws InvalidRequestException, RecordNotFoundException, LogicException
name
- contains the name of the form field from
which the browse will startInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLogicException
- a ILLOGIC condition occurredpublic void startBrowseFormField(java.lang.String name, java.lang.String hostCodePage, java.lang.String characterset) throws InvalidRequestException, RecordNotFoundException, LogicException
name
- contains the name of the form field from
which the browse will starthostCodePage
- contains the host code-page to be used when the forms data
is converted from the ASCII code-page it was received in, into the
EBCDIC code-page in which CICS will process itcharacterset
- contains the code-page in which the form is encodedInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLogicException
- a ILLOGIC condition occurredpublic FormField getNextFormField() throws InvalidRequestException, EndOfFileException
InvalidRequestException
- a INVREQ condition occurredEndOfFileException
- a ENDFILE condition occurredpublic void endBrowseFormField() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic void startBrowseQueryParm() throws InvalidRequestException, RecordNotFoundException, LogicException
InvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLogicException
- a ILLOGIC condition occurredpublic void startBrowseQueryParm(java.lang.String name) throws InvalidRequestException, RecordNotFoundException, LogicException
name
- contains the name of the keyword parameter
from which the browse will startInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLogicException
- a ILLOGIC condition occurredpublic QueryParm getNextQueryParm() throws InvalidRequestException, EndOfFileException
InvalidRequestException
- a INVREQ condition occurredEndOfFileException
- a ENDFILE condition occurredpublic void endBrowseQueryParm() throws InvalidRequestException
InvalidRequestException
- a INVREQ condition occurredpublic final void drive_ibmJVMTidyUp()
drive_ibmJVMTidyUp
in interface com.ibm.cics.ras.server.TidyUpOnTermination
drive_ibmJVMTidyUp
in class TcpipRequest