NonStop Servlets for JSP System Administrator's Guide
Configuring NSJSP
NonStop Servlets for JavaServer Pages (NSJSP) System Administrator’s Guide—525644-001
3-14
Deploy a Servlet
The deployment descriptor is used to customize other servlet parameters such as:
•
Initializing Servlets on page 3-10.
•
Preloading Servlets on page 3-8.
•
Defining a Session Timeout Value on page 3-9.
•
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 it 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 the 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.
Example 3-11 is an example of how to set the MIME type:
Example 3-10. Deploying a Servlet
<?xml version="1.0" encoding="ISO-8859"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.3.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>
Example 3-11. Setting the MIME Type
<web-app>
<mime-mapping>
<extension>doc</extension>
<mime-type>application/msword</mime-type>
</mime-mapping>
</web-app>