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-30
Using the Servlet API
Classes that Facilitate Servlet Usage in an iTP Secure WebServer
Environment
HttpServlet
This class extends the class GenericServlet by overriding the
service(ServletRequest,ServletResponse) method, which receives, processes, and
responds to a request from a web client. The HttpServlet class inherits the
init(ServletConfig) and destroy( ) methods from the GenericServlet class.
A servlet that you write for the iTPWebServer environment must extend either the
GenericServlet class or the HttpServlet class; the HttpServlet class is preferable for the
web environment because it includes many features supporting HTTP protocol. Your
servlet should override the init(ServletConfig) method to perform any necessary
initialization, the service(ServletRequest,ServletResponse) or
service(HttpServletRequest,HttpServletResponse) method to process requests as the
application requires, and the destroy( ) method to deallocate resources gracefully.
Your servlet should also use the doGet( ) and doPost( ) methods where applicable.
HttpServletRequest
This class extends the ServletRequest class, which provides methods for retrieving
information from a standard input stream and obtaining the values of various headers
and environment variables. The HttpServletRequest class defines methods for obtaining
http-protocol header information and CGI environment variables such as
QUERY_STRING, PATH_INFO, and PATH_TRANSLATED.
To obtain an enumeration of all CGI environment variables in effect for a servlet, use the
getAttribute( ) method with the string parameter value
"com.tandem.servlet.attribute_names"
HttpServletResponse
This class extends the ServletResponse class, which provides methods for writing to the
standard output stream and error file. The HttpServletResponse class defines methods
for sending http response headers and error information to the web client.
To generate its own response headers, a servlet must generate all such headers before
writing any data to the output stream; otherwise, the ServletOutputStream class sends
only the following header:
CONTENT_TYPE=text/html
ServletException
This class provides methods for reporting servlet-specific exceptions. The doGet( ) and
doPost( ) methods of your servlet should use this class, or a class you derive from this
class, to report an error.