Sun Java System Web Server 7.0 Update 4 Developer's Guide to Java Web Applications

Migrating Legacy Servlets

Netscape Enterprise Server/ iPlanet Web Server versions 4.0 and 4.1 supported the Java Servlet 2.1 specification. This specification did not include web applications. A deployment scheme was developed to make servlet deployment simpler. With the advent of Java web applications (WAR files) and their deployment descriptors, maintaining a proprietary deployment system is no longer necessary.

iPlanet Web Server 6.0 supported both types of deployment schemes, but the 4.x implementation (referred to as legacy servlets) was marked as deprecated (See Chapter 8 Legacy Servlet and JSP Configuration of the iPlanet Web Server, Enterprise Edition Programmer's Guide to Servlets).

Web Server versions 6.1 and 7.0 no longer support legacy servlets. The legacy properties files for the server you want to migrate (,, and are removed during migration.

Because no one-to-one mapping is possible for all of the features, legacy servlets cannot be migrated automatically. This section describes the main features involved in migrating legacy servlets to web applications.

This section includes the following topics:

JSP file by Extension

In Web Server, JSP file by extension works as it did in previous releases. Any file name in the document tree with a suffix of .jsp is treated as a JSP environment as long as the Java is turned on for the virtual server.

Servlet by Extension of Servlet by Directory

Servlet extension is not supported in Web Server. You can deploy a web application to respond to a directory, but all of the servlets must be in the WEB-INF/classes directory of the web application. You can no longer copy a servlet in the .class file into the document tree and have it run as a servlet or have all of the contents of a directory run as a servlet. The web application treats only .class files as servlets.

Registering Servlets

The legacy servlet system used a two-step process of registering servlets ( and mapping them to a URL ( In Web Server, the servlets must be moved into a web application. These settings will be maintained in the web.xml file of that web application.

A registered servlet has entries in both the and files.

The following example uses a servlet file called BuyNow1A.class, which responds to /buynow. It is assumed that the web application is deployed at '/'

The file containing:

Example 4–1 Registering Servlets Example

servlet.BuyNowServlet.initArgs=arg1=45,arg2=online,arg3="quick shopping"

The file has:


These settings must be translated to a web.xml setting. The setting translates into the servlet element.

The classpath is automated so no classpath setting is necessary. All classes to be used must be in the WEB-INF/classes directory or in a .jar file in the WEB-INF/lib directory of the web application.

The servlet-name element appears between the dots in the file. The code translates to the servlet-class, IntArgs translate to init-params. This entry will translate to the following entry:

<servlet-name> BuyNowServlet </servlet-name>
<servlet-class> BuyNow1A </servlet-class>
				<param-value> arg1 </param-name>
				<param-value> 45 </pram-value>
				<param-name> arg2 </param-name>
				<param-value> online </param-value>
				<param-name> arg3 </param-name>
				<param-value> 'quick shopping" </param-value>

The entries translate to servlet-mapping elements. This entry translates to the following entry:

	<servlet-name> BuyNowServlet </servlet-name>
	<url-pattern> /buynow </url-pattern>

Some other entries in the file map to the web.xml file. This includes the following information: