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-25
How to Add a New Web Application
(where * is the servlet name). This command will compile the java files and create the
class files under /WEB-INF/classes.
Deploying a Servlet
Enter a servlet and class name in the deployment descriptor. You can use the same name
for servlet and class names, or the servlet name may be used as an alias in a URL rather
than revealing the whole servlet class name. Thus, in the example below the URL would
be able to refer to start rather than startCartRequest.
The deployment descriptor is usually located in web.xml file at the top level of your
application directory in /webapps/WEB-INF/. A fragment of that file is shown below:
<?xml version="1.0" encoding="ISO-8859"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<servlet>
<!used as an alias for the full servlet class name>
<servlet-name>start<servlet-name>
<!the fully qualified servlet class name>
<servlet-class>startCartRequest</servlet-class>
</servlet>
</web-app>
The deployment descriptor is used to customize other servlet parameters such as:
Initialization of Servlets on page 9-22
Preloading Servlets on page 9-21.
Defining a Session Timeout Value on page 9-22
MIME Mapping. The HTTP protocol uses Multipurpose Internet Mail Extensions
(MIME) types for describing content. When a web server sends a document to a
client, the server should include a section in the response to indicate the type of
document so the browser can render it correctly. Most browsers can guess the type
from the extension, for example doc, pdf, or gif but is good programming practice to
include a definition in the deployment descriptor.
This is not necessary for dynamic content where the servlet generating the response
should specify the MIME type using setContentType() on the HttpServletResponse
object, but it is useful to define the MIME types for your static content in the public
area of the web application.
Default MIME types are provided in the mime-types.config file in conf directory of
the root (our default is /usr/tandem/webserver/). You may add to that file. If you do,
you must also add those MIME types in the global web.xml file in the
../servlet_jsp/conf directory. Heres an example of how to set the MIME type: