Providing static HTTP responses with a XCICS document template or flat file

Top  Previous  Next

You can use a XCICS flat files to provide a static response to an HTTP request from a Web client.

The following task-specific components of XCICS Web support are used for this task:

TCPIPSERVICE resource definitions
URIMAP resource definitions
Files in HFS
XCICS document template support
Security facilities
Web error programs

"HTTP requests and response processing (as server)" explains how the process elements work together.

1.Consider security issues for this XCICS Web support task. For application-generated responses, XCICS can implement HTTP basic authentication for a connection, where the user must supply an ID and password. (Basic authentication does not operate for items delivered as a static response). You can use the user ID to control access to individual resources. If you need to protect information passed over the Internet (including the user IDs and passwords used for basic authentication), consider using Secure Sockets Layer (SSL). For more information, see "Security for XCICS Web support".
2.If you want to use a UNIX/Linux/Windows flat file to provide a response, create the file and place it in an appropriate location of your choice in the file system. When this response is identified by a URIMAP definition that matches the Web client's request, XCICS retrieves the file send it as response.
a.Do not include any HTTP headers or status line information in the file. XCICS generates the required information when the response is sent. The file only provides the body of the response.
b.The location of the file is significant if you want to use path matching, as described later in this topic. If you do not want to use path matching, the location of the file does not need to have any relationship to the URL of the request.
c.The XCICS region must have permissions to access to access the directory containing the file, and the file itself.
3.Identify the media type (type of data content) that is provided by the file. You may let XCICS to recognize automatically the media type depending on the file extention.
Note that when you use a URIMAP definition to send a static response, the use of quality factors (the "q" parameter) is not supported. Quality factors can be used to choose among a client's list of acceptable media types or character sets, as specified in Accept  headers. If you want to carry out this type of analysis, an application-generated response can be used instead.
4.Decide on the URL that the Web client will use for each request, including the scheme, host and path components, and any query string.
5.Decide whether you want to use path matching in the URIMAP definition. If so, plan your request URLs, and arrange the names of your XCICS your files to support this. In path matching, a wildcard character is used in the path component of the URIMAP definition, and also in the name of the file that is specified by the URIMAP definition. The portion of the path that is covered by the wildcard character is used to select the file to provide the response.
 
For files, the portion of the path that is covered by the wildcard character is substituted as the last part of the file name. You can store a number of files in the same directory, and access them using request URLs whose paths begin in the same way, through a single URIMAP definition. Bear in mind that because a URIMAP definition must specify a type of data content (the MEDIATYPE attribute), a single URIMAP definition can only handle a group of files that produce the same type of data content.
6.Decide on the port that will be used for the requests.
7.If you do not yet have a TCPIPSERVICE definition for the port on which the requests are received, follow the procedure in "Creating