iTP Secure WebServer System Administrator's Guide (iTPWebSvr 5.1+)
Using NonStop Servlets for JavaServer Pages With
The iTP Secure WebServer
iTP Secure WebServer System Administrator’s Guide—522659-001
9-27
Client Programming Considerations
Path mappings are relative to the context’s URL path. By providing a wildcard (*) any
URL containing the path /myapplication will now always be passed to the
startCartRequest servlet.
Client Programming Considerations
To an HTML document or a web client, there is very little difference between using a
servlet and using any other type of CGI application.
Before you read this, you should be familiar with the information in Section 8, Using
Common Gateway Interface (CGI) Programs.
Invoking a Servlet
You invoke a servlet by including a reference to its URL. The syntax of a servlet URL is
described in Mapping Requests to Applications and Servlets on page 9-26.
Passing Request Information
You can pass request information to a servlet by any of the following means:
•
Query strings appended to URLs. The servlet receives this data through the
QUERY_STRING environment variable, or through a hash table if the servlet uses
the HttpUtils class.
•
Extra path information appended to URLs. The servlet receives this information
through the PATH_INFO and PATH_TRANSLATED environment variables.
•
HTML forms. A servlet receives data from HTML forms in an input stream.
A servlet accesses environment variables and the input stream through an object, as
described in Using the Servlet API
on page 9-29.
Receiving Response Information
The response from a servlet has the same form as the output from any other CGI
program. That is, the response consists of:
•
One or more http response headers
•
A blank line
•
The response content
However, the servlet itself need not generate all these elements. If the servlet does not
provide header information, the servlet methods insert the header
content-type: text/html. If the servlet does not include the blank line, the servlet methods
insert the required carriage return and linefeed.
For information about how a servlet generates its output, see Using the Servlet API
on
page 9-29.