NonStop Servlets for JavaServer Pages (5.0) System Administrator's Guide
Programming and Management Features
NonStop Servlets for JavaServer Pages (NSJSP) System Administrator’s Guide—525644-002
4-5
Using the Servlet API
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 iTP WebServer environment must extend 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.
The HttpServletRequest Class
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 getHeaderNames() or getAttribute() methods with the string parameter
value
"com.tandem.servlet.attribute_names"
The HttpServletResponse Class
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.
CONTENT_TYPE=text/html
The ServletException Class
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.