iTP Secure WebServer System Administrator's Guide (iTPWebSvr 6.0+)

Using NonStop Servlets for JavaServer Pages
(NSJSP)
iTP Secure WebServer System Administrator’s Guide—523346-002
9-4
How To Map From URL To Servlet
By default, the /webapps subdirectory contains your server applications. (Use
docbase in iTP_server.xml to set this path, or any other preferred location).
Myapps1 is an example application subdirectory. At this (root) level you can store files
such as index.html, or create subdirectories to manage your web application
resources, for example /images for graphics files.
There is a convention for application directory structures.
Every application must have a WEB-INF subdirectory. This is a required subdirectory. It
is a private area whose contents cannot be directly served to users. WEB-INF is a
structured set of subdirectories containing servlet classes, archives, and another
deployment descriptor (application-specific) web.xml file. Use this web.xml file to
override any settings made with global scope in web.xml in the
/servlet_jsp/conf directory.
Java class files are located in the /classes subdirectory. This is a required
subdirectory. The server looks for class files here (either by class name or alias - set in
either web.xml file), and places class files here after exploding JAR files stored in
/lib.
You could also place Java source files in a /src subdirectory. This is optional.
For further details, see Configuring the Web Application on page 9-24.
How To Map From URL To Servlet
The key question is, how do you map from a URL to the application and to the servlets
or JSP?
The application name and the context path gets you to the application subdirectory. No
further path is necessary to find a servlet or JSP within that application. The
deployment descriptor xml (web.xml) file defines the rest of the path.
The location of the application directory (and therefore the servlet or JSP) is
determined in the docbase attribute inside iTP_server.xml.
The servlet or JSP could be any name (given the <servlet-name> and <servlet-
class> xml elements of the web.xml file) not just the class name. This allows
separation between the web pages (using a servlet name) and the underlying Java
code (using the class name) and so makes maintenance easier.
The servlet or JSP does not even need a name, given the <servlet mapping> xml
element of the web.xml file. You can set the mapping so that one servlet or JSP is
always the start of the application. If so, it does not need to be named in the URL. This
is certainly convenient, and it may also be more secure.
For further details, see Map Requests to Applications and Servlets on page 9-28.