To map a servlet class to an alias you need to modify the web.xml file in
the WEB-INF directory containing your class files.
The syntax is:
<servlet>
<servlet-name>shortName</servlet-name>
<servlet-class>className</servlet-class>
</servlet>
Then to map a url:
<servlet-mapping>
<url-pattern>/shortName</url-pattern>
<servlet-name>shortName</servlet-name>
</servlet-mapping>
These go withing the <webapp></webapp> tags.
Explaination of web.xml is contained in Java Servlet Specification 2.2. The
deployment descriptor section. It will also discuss how to set up folders in
the webapss directory.
You can download the spec in PDF or postscript format at:
http://java.sun.com/products/servlet/download.html#specs
-----Original Message-----
From: Escolar, Carlos (Carlos) [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 20, 2000 11:47 AM
To: '[EMAIL PROTECTED]'
Subject: Adding a Servlet documentation
I just started using Tomcat (standalone). I am trying to add a Servlet, and
I am finding
it not well documented. (Isn't this the first thing that every one wants to
do?) Who is responsible to update the build/tomcat/doc/tomcat_ug.html file
with this information?
Lets say that I have a class called com.avaya.myclass and I want to get to
it using the URI:
http://localhost:8080/MC
Which steps must I take to accomplish this?
(I have figured out that if I create a directory under
build/tomcat/webapps/examples/WEB-INF/classes called com, then a directory
named avaya and then place myclass.class there, the following URI will work
to reach my Servlet:
http://localhost:8080/servlet/com.avaya.myclass
I would like to know:
1) How do I create a synonym so I don't have to type the long
"servlet/com.avaya.myclass".
2) How do I tell Tomcat where my classes are (so I don't have to place them
under webapps/examples)
Carlos Escolar
Avaya Inc.
[EMAIL PROTECTED]