
Configuring Servlets in the Default Virtual Server
82 iPlanet Web Server, Enterprise Edition Programmer’s Guide to Servlets • May 2001
For example, if the SimpleServlet.class servlet is in the servlet subdirectory of
the server’s document root directory (the default servlet directory), you can invoke
the servlet by pointing the web browser to:
http://your_server/servlet/SimpleServlet
iPlanet Web Server expects all files in a registered servlet directory to be servlets.
The server treats any files in that directory that have the
.class extension as
servlets. The iPlanet Web Server does not correctly serve other files, such as HTML
files or JSPs, that reside in that directory.
The server can have multiple servlet directories. You can map servlet directories to
virtual directories if desired. For example, you could specify that
http://poppy.my_domain.com/products/ invokes servlets in the directory
server_root
/docs/january/products/servlets/.
To register servlet directories and to specify their URL prefixes, use the Legacy
Servlets>Servlet Directory page in the Server Manager interface.
Alternatively, you can register servlet directories by adding appropriate
NameTrans directives to the default object in the file obj.conf, such as:
You can invoke a servlet in a subdirectory of a registered servlet directory if you
include a package directive in the servlet code that corresponds to the path from
the registered servlet directory. For example, suppose the servlet is in the following
location, and that server_root
/docs/servlet/ is a registered servlet directory:
server_root
/docs/servlet/HelloWorld/HelloWorldServlet.class
Include the following package directive as the first line in the Java source file:
package HelloWorld;
You can then invoke the servlet by pointing the web browser to:
http://your_server/servlet/HelloWorld.HelloWorldServlet
For information about reloading packaged servlets, see
“isModifiedCheckAggressive,” on page 92.
NameTrans fn="pfx2dir" from="/products"
dir="d:/netscape/server4/docs/january/products/servlets/"
name="ServletByExt"
Comentários a estes Manuais