The legacy servlet system used a two-step process of registering servlets (servlet.properties) and mapping them to a URL (rules.properties). 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 servlet.properties and rules.properties 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 servlet.properties file containing:
servlet.BuyNowServlet.classpath=D:/Netscape/server4/docs/ servlet/buy;D:/Netscape/server4/docs/myclasses servlet.BuyNowServlet.code=BuyNow1A servlet.BuyNowServlet.initArgs=arg1=45,arg2=online,arg3="quick shopping"
The rules.properties file has:
/buynow=BuyNowServlet
These settings must be translated to a web.xml setting. The servlet.properties 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 servlets.properties file. The code translates to the servlet-class, IntArgs translate to init-params. This entry will translate to the following entry:
<servlet> <servlet-name> BuyNowServlet </servlet-name> <servlet-class> BuyNow1A </servlet-class> <init-param> <param-value> arg1 </param-name> <param-value> 45 </pram-value> </init-param> <init-param> <param-name> arg2 </param-name> <param-value> online </param-value> </init-param> <init-param> <param-name> arg3 </param-name> <param-value> 'quick shopping" </param-value> </init-param> </servlet>
The rules.properties entries translate to servlet-mapping elements. This entry translates to the following entry:
<servlet-mapping> <servlet-name> BuyNowServlet </servlet-name> <url-pattern> /buynow </url-pattern> </servlet-mapping>
Some other entries in the servlet.properties file map to the web.xml file. This includes the following information:
Servlets.startup: This servlet should contain the load-on-startup element.
Servlets.config.reloadInterval: This setting translates to the dynamicreloadinterval attribute of the jvm element in servlet.xml. This instance-wide setting affects all virtual servers and all web applications.
Servlet.sessionmgr: This element translates to the session-manager element in the sun-web.xml.