public class HttpResponse extends API
This class provides the Java implementation of HTTP responses related to the following CICS API WEB server commands:
The writeHeader() method allows HTTP header information to be added to a response. This is equivalent to CICS API command WEB WRITE.
The setter methods allow instance variables to be set in the HttpResponse object. These variables relate to the following options on the CICS API command WEB SEND:
The sendDocument() method sends the specified Document object to the clients browser. This is equivalent to CICS API command WEB SEND DOCUMENT.
The sendFrom() method sends an application buffer to the clients browser. This is equivalent to CICS API command WEB SEND FROM.
The sendChunk() sends a chunk of a chunked response to the client. When all the chunks of the chunked response have been sent the sendLastChunk() method must be used to terminate the chunked response. This is equivalent to using CICS API commands WEB SEND FROM CHUNKYES and WEB SEND CHUNKEND to send a chunked response.
The sendContainer() method sends the data held in a named container to the client. This is equivalent to CICS API command WEB SEND CONTAINER.
A equivalent method for CICS API command WEB RETRIEVE is not supplied. This command returns the DOCTOKEN of the document sent using an earlier WEB SEND command. The Document object sent by the sendDocument() method should still be available so a method equivalent to this command is not required.
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 |
---|
HttpResponse()
Usage:
Public default constructor. |
Modifier and Type | Method and Description |
---|---|
void |
sendChunk(byte[] from)
Usage:
Send a chunk of the chunked response to the client. |
void |
sendChunk(java.lang.String from)
Usage:
Send a chunk of the chunked response to the client. |
void |
sendContainer(Container container)
Usage:
Send the data stored in a container to the client. |
void |
sendDocument(Document doc)
Usage:
Send a document to the client. |
void |
sendDocument(Document doc,
short statusCode,
java.lang.String statusText,
java.lang.String characterset)
Usage:
Send a document to the client. |
void |
sendFrom(byte[] from)
Usage:
Send an application buffer to the client. |
void |
sendFrom(java.lang.String from)
Usage:
Send an application buffer to the client. |
void |
sendLastChunk()
Usage:
Indicate that the chunked response is complete. |
void |
setActionEventual()
Usage:
Sets WEB SEND command option ACTION to EVENTUAL. |
void |
setActionImmediate()
Usage:
Sets WEB SEND command option ACTION to IMMEDIATE. |
void |
setCharacterset(java.lang.String characterset)
Usage:
Sets WEB SEND command option CHARACTERSET. |
void |
setClientCodePage(java.lang.String characterset)
Usage:
Sets WEB SEND command option CHARACTERSET. |
void |
setClose()
Usage:
Sets WEB SEND command option CLOSESTATUS to CLOSE. |
void |
setDocDelete()
Usage:
Sets WEB SEND command option DOCSTATUS to DOCDELETE. |
void |
setHostCodePage(java.lang.String hostCodePage)
Usage:
Sets WEB SEND command option HOSTCODEPAGE. |
void |
setMediaType(java.lang.String mediaType)
Usage:
Sets WEB SEND command option MEDIATYPE. |
void |
setNoClose()
Usage:
Sets WEB SEND command option CLOSESTATUS to NOCLOSE. |
void |
setNoDocDelete()
Usage:
Sets WEB SEND command option DOCSTATUS to NODOCDELETE. |
void |
setNoServerConvert()
Usage:
Sets WEB SEND command option SERVERCONV to NOSRVCONVERT. |
void |
setServerConvert()
Usage:
Sets WEB SEND command option SERVERCONV to SRVCONVERT. |
void |
setStatus(short statusCode,
java.lang.String statusText)
Usage:
Sets WEB SEND command option STATUSCODE and STATUSTEXT.. |
void |
writeHeader(java.lang.String header,
java.lang.String value)
Usage:
Add HTTP header information to the response. |
public static final int NOTSET
public HttpResponse()
public void writeHeader(java.lang.String header, java.lang.String value) throws InvalidRequestException, LengthErrorException
header
- contains the name of the HTTP headervalue
- contains the value of the named headerInvalidRequestException
- a INVREQ condition occurredLengthErrorException
- a LENGERR condition occurredpublic void setServerConvert()
public void setNoServerConvert()
public void setClientCodePage(java.lang.String characterset)
characterset
- contains the code-page into which the HTTP response body is to be converting
when the WEB SEND command is issuedpublic void setCharacterset(java.lang.String characterset)
characterset
- contains the code-page into which the HTTP response body is to be converting
when the WEB SEND command is issuedpublic void setHostCodePage(java.lang.String hostCodePage)
hostCodePage
- contains the code-page that the data being sent by the WEB SEND command is
encoded inpublic void setMediaType(java.lang.String mediaType)
mediaType
- contains mediaType information to be used by the WEB SEND commandpublic void setStatus(short statusCode, java.lang.String statusText)
statusCode
- contains a HTTP status codestatusText
- contains text describing the value of the status codepublic void setClose()
public void setNoClose()
public void setActionEventual()
public void setActionImmediate()
public void setDocDelete()
public void setNoDocDelete()
public void sendDocument(Document doc, short statusCode, java.lang.String statusText, java.lang.String characterset) throws InvalidRequestException, RecordNotFoundException, LengthErrorException, IOErrorException, ContainerErrorException, ChannelErrorException
doc
- is the Document object to be sent to the clientstatusCode
- contains a HTTP status codestatusText
- contains text describing the value of the status codecharacterset
- contains the name of the ASCII code-page in which the data
is to be delivered to the browserInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLengthErrorException
- a LENGERR condition occurredIOErrorException
- a IOERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendDocument(Document doc) throws InvalidRequestException, RecordNotFoundException, LengthErrorException, IOErrorException, ContainerErrorException, ChannelErrorException
doc
- is the Document object to be sent to the clientInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLengthErrorException
- a LENGERR condition occurredIOErrorException
- a IOERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendFrom(java.lang.String from) throws InvalidRequestException, RecordNotFoundException, LengthErrorException, IOErrorException, ContainerErrorException, ChannelErrorException
from
- is the data to be sent to the clientInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLengthErrorException
- a LENGERR condition occurredIOErrorException
- a IOERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendFrom(byte[] from) throws InvalidRequestException, RecordNotFoundException, LengthErrorException, IOErrorException, ContainerErrorException, ChannelErrorException
from
- is the data to be sent to the clientInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLengthErrorException
- a LENGERR condition occurredIOErrorException
- a IOERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendChunk(java.lang.String from) throws InvalidRequestException, RecordNotFoundException, LengthErrorException, IOErrorException, ContainerErrorException, ChannelErrorException
from
- is the data that forms a subsequent chunk of the chunked response being sent
to the clientInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLengthErrorException
- a LENGERR condition occurredIOErrorException
- a IOERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendChunk(byte[] from) throws InvalidRequestException, RecordNotFoundException, LengthErrorException, IOErrorException, ContainerErrorException, ChannelErrorException
from
- is the data that forms a subsequent chunk of the chunked response being sent
to the clientInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLengthErrorException
- a LENGERR condition occurredIOErrorException
- a IOERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendLastChunk() throws InvalidRequestException, RecordNotFoundException, LengthErrorException, IOErrorException, ContainerErrorException, ChannelErrorException
InvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLengthErrorException
- a LENGERR condition occurredIOErrorException
- a IOERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurredpublic void sendContainer(Container container) throws InvalidRequestException, RecordNotFoundException, LengthErrorException, IOErrorException, ContainerErrorException, ChannelErrorException
container
- is the Container that holds the data to be sent to the clientInvalidRequestException
- a INVREQ condition occurredRecordNotFoundException
- a NOTFND condition occurredLengthErrorException
- a LENGERR condition occurredIOErrorException
- a IOERR condition occurredContainerErrorException
- a CONTAINERERR condition occurredChannelErrorException
- a CHANNELERR condition occurred