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 Guide522659-001
9-6
The Web Container
only the GUI, but also most of the application logic. Web clients, on the other hand,
belong to a newer three tier model where the “thin” client (typically a browser) supplies
the GUI, and a middleware layer, on a Webserver, provides the application logic
between the GUI and the database. The middleware layer itself is now typically based on
reusable components designed in a Model-View-Controller architecture. For an
introduction to this concept, see Model-View-Controller Designs
(See page 9-33).
The web client model typically uses Hypertext Transfer Protocol (http) to provide a
request-response relationship between the browser and the application logic. The client
Resource Locator (URL) - for example www.company.com/index.html - consists of the
domain name - www.company.com - and the Universal Resource Identifier (URI), the
name of the resource, in this case - index.html. The URI provides the context path which
is used to locate servlets, see Mapping Requests to Applications and Servlets
(See page
9-26).
Initially http resources were static pages of text or graphics, the same resource being
served to each client request, but now the emphasis is on building and using dynamic
resources where the same resource can be dynamically modified for each different client
request. An example could be a mailbox, where the structure and function is the same,
but the content is clearly different for each user.
Dynamic content was initially supplied by CGI, but now the more powerful and flexible
servlet API and JSP programs are used to provide logic for the new web applications.
The Web Container
For building and running web-based applications J2EE provides a web container- a Java
runtime environment with the following content:
The applications - Java servlets and JavaServer pages, class libraries, resources such
as HTML or XML documents, and images.
The servlet API and runtime management including initializing, invoking and
managing the servlet and JSP lifecycles.
The deployment descriptors (the web.xml file) that contain resource definitions such
as MIME types, mapping of requests to servlets, access control and servlet
initialization parameters. This xml file essentially replaces the servlet properties file
used in previous versions of servlets, such as Servlets 2.0 in Compaq product
number T0094.
It is the web container’s responsibility to instantiate the servlet and provide the
communication between the iTPWebserver and the servlet. The container provides the
following services:
Instantiate the servlet
Invoke the servlet’s init( ) method
Service requests from the user by invoking the service( ) method
Invoke the destroy( ) method when the servlet is to be garbage collected
Manage a similar lifecycle for JSP files