NonStop Servlets for JavaServer Pages (5.0) System Administrator's Guide

Configuring NSJSP
NonStop Servlets for JavaServer Pages (NSJSP) System Administrator’s Guide525644-002
3-19
Deploy a Servlet
The deployment descriptor is used to customize other servlet parameters such as:
Initializing Servlets on page 3-13.
Preloading Servlets on page 3-11.
Defining a Session Timeout Value on page 3-12.
MIME Mapping. The HTTP protocol uses Multipurpose Internet Mail Extensions
(MIME) types for describing content. When a webserver 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 the document 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 (the default is /usr/tandem/webserver/conf). You may add to that
file. If you do, you must also add those MIME types in the global web.xml file in
the $NSJSP_HOME/conf directory.
Example 3-11. Deploying a Servlet
<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>
<servlet-mapping>
<!-- The alias for the servlet class name specified above -->
<servlet-name>start</servlet-name>
<!-- The URL pattern to map to the servlet alias -->
<url-pattern>/myapp1/*</url-pattern>
</servlet-mapping>
</web-app>
Example 3-12. How to Set the MIME Type
<web-app>
<mime-mapping>
<extension>doc</extension>
<mime-type>application/msword</mime-type>
</mime-mapping>
</web-app>