Table of Contents | Previous | Next | Index | Bookshelf

Programmer's Guide to Servlets


Appendix B
Servlet Settings in obj.conf

The iPlanet Web Server 4.1 Administration Server automatically modifies the file obj.conf in the config directory to load the servlet engine if servlets are enabled. Whenever you make changes to servlet settings by using the Server Manager interface, the system automatically updates obj.conf appropriately.

However, in case you are interested in the settings that affect servlets, this appendix describes the directives in obj.conf and value settings in mime.types that are relevant to servlets.

Directives for Enabling Servlets

The following directives in the init section of obj.conf load and initialize the servlet engine to enable servlets (for Windows NT):

Init fn="load-modules" shlib="server_root/bin/https/bin/NSServletPlugin.dll" funcs="NSServletEarlyInit,NSServletLateInit,NSServletNameTrans, NSServletService" shlib_flags="(global|now)"
Init fn="NSServletEarlyInit" EarlyInit=yes
Init fn="NSServletLateInit" LateInit=yes
for Unix, the directives are the same except for the following line:

Init fn="load-modules" shlib="server_root/bin/https/lib/libNSServletPlugin.so"
NSServletEarlyInit takes an optional parameter cache_dir that specifies the location of a temporary cache directory for JSP classes. By default, the directory is named ClassCache and goes under your server root directory.

NSServletLateInit takes an optional parameter CatchSignals that specifies whether or not Java thread dumps are logged. The value is yes or no.

NSServletService takes two optional parameters, servlet="servlet_name" and context="context_name". These parameters allow you to define objects in obj.conf that generate responses for specific servlets or contexts. You can use one or both parameters in a directive. The servlet or context must be defined in the servlets.properties or contexts.properties file. You can define an object that pertains to a particular servlet, a particular servlet context, or both, as follows:

<Object name="MyServlet">
Service fn="NSServletService" context="MyServletContext" servlet="MyServletName"
</Object>
For an example of the basic use of NSServletService, see the discussion of Service examples in Chapter 2, "Syntax and Use of Obj.conf" in the NSAPI Programmer's Guide for iPlanet Web Server.

When servlets are enabled, the following directive appears in the default object:

NameTrans fn="NSServletNameTrans" name="servlet"
This directive is used for servlet virtual path translations and for the URI cache. Do not delete this line when servlets are enabled.

Also, obj.conf always has the following objects, which you should not delete:

<Object name="servlet">
Service fn="NSServletService"
</Object>
<Object name="jsp">
Service fn="NSServletService"
</Object>
If you delete these objects, you can no longer use the Server Manager interface to enable servlets and modify servlet settings.

For more information, see the NSAPI Programmer's Guide for iPlanet Web Server.

Directives for Registered Servlet Directories

For each registered servlet directory, the default object in obj.conf has a NameTrans directive that assigns the name ServletByExt to all requests to access that directory. For example:

NameTrans fn="pfx2dir" from="/servlet" dir="D:/Netscape/Server4/docs/servlet" name="ServletByExt"
A separate object named ServletByExt has instructions for processing requests for servlets:

<Object name="ServletByExt">
ObjectType fn="force-type" type="magnus-internal/servlet"
Service type="magnus-internal/servlet" fn="NSServletService"
</Object>
Do not delete this object, even if no servlet directories are currently registered. If this object is deleted, you can no longer use the Server Manager interface to register servlet directories.

JSP

The following line in mime.types sets the type for files with the extension .jsp:

type=magnus-internal/jsp exts=jsp
When JSP is enabled, the following directive in obj.conf handles the processing of requests for files of type magnus-internal/jsp (that is, JSP files):

Service fn="NSServletService" type="magnus-internal/jsp"

Table of Contents | Previous | Next | Index

Last Updated: 02/25/00 16:19:13

© Copyright © 2000 Sun Microsystems, Inc. Some preexisting portions Copyright © 2000 Netscape Communications Corp. All rights reserved.