Writing HTTP headers for a response

For dynamic responses created by application programs, CICS® automatically provides the HTTP headers that are required for basic messages, depending on the HTTP protocol version used for the message. Your application does not need to write these headers. However, you might want to add further HTTP headers to your response.

About this task

Here is the full list of headers created by CICS :
  • ARM correlator
  • Connection
  • Content-Type (written by CICS, but can be supplied by a client application if a complex header is required)
  • Content-Length
  • Date
  • Expect
  • Host
  • Server (automatic creation depends on system initialization parameter HTTPSERVERHDR
  • TE (written by CICS but further instances may be added)
  • Transfer-Encoding
  • User-Agent (automatic creation depends on system initialization parameter HTTPUSRAGENTHDR
  • WWW-Authenticate
Note that some of these headers are appropriate, and created, only when CICS is an HTTP client. The circumstances in which these headers are created are described in HTTP header reference for CICS web support . If you do write these headers on a response, CICS does not overwrite them, but uses the versions provided by your application.
The headers that CICS provides when a response is sent are the ones that are typically written to make a basic message comply with the appropriate HTTP protocol specification. You might want to add further HTTP headers to the response for some purposes:
  • Control of caching and document expiry; for example, Cache-Control, Expires, Last-Modified.
  • Content negotiation; for example, Accept-Ranges, Vary.
  • Information for the web client; for example, Title, Warning, further Content headers.
If your application program is performing complex actions, or if you select certain status codes for your response, the HTTP specification to which you are working is likely to require the use of particular HTTP headers for your message. When you add any HTTP headers to a response, check the HTTP specification to which you are working for any important requirements that apply to those headers. See The HTTP protocol for more information about the HTTP specifications.

Write additional HTTP headers for a message before you issue the WEB SEND command to send the message. The exception to this rule is when you write headers to be sent as trailing headers on a chunked message, in which case the subsequent procedure applies. To write HTTP headers for a response:

Procedure



dfhtl_appsweb_headerwrite.html | Timestamp icon Last updated: Monday, 5 June 2017