tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: Are servlet name and class name required in web.xml for tomcat 5.5?
Date Wed, 25 Jan 2006 12:42:06 GMT
You're talking about the Invoker servlet that automagicly mapped
requests to servlets.  This is a bad security problem that's best avoided.

First you need to declare all your servlets in web.xml:

<servlet>
  <servlet-name>NameOfServlet</servlet-name>
  <servlet-class>com.mycompany.myproject.MyServlet</servlet-class>
</servlet>

then declare the mappings of requests to servlets:

<servlet-mapping>
  <servlet-name>NameOfServlet</servlet-name>
  <url-pattern>/doAction/*</url-pattern>
</servlet-mapping>

In servlet specs prior to 2.4, the order of elements in the web.xml file
was important.  All the <servlet> elements had to be together and
precede the <servlet-mapping> elements.  Writing the web.xml file to
servlet spec 2.4 standard eliminates the ordering requirement.  More
information on this subject can be found in the servlet specs
themselves.  Tomcat 5.5 is servlet spec 2.4 conformant but can work with
previous servlet specs.

http://java.sun.com/products/servlet/download.html

--David

Alla Winter wrote:

>For Tomcat 4.x I didn't have to set up anything in web.xml.  But it seems
>that I have to define each servlet name and corresponding class name in
>web.xml in order to make it to work for Tomcat 5.5.  Is that right
>statement? 
>I have a lot of servlets, it seems like it is a lot of work.
>Can not find what info is required in web.xml and what is optional? Can you
>please refer me to that info?
>Thanks 
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>  
>


-- 
=======================================
David Smith
Network Operations Supervisor
Department of Entomology
College of Agriculture & Life Sciences
Cornell University
2132 Comstock Hall
Ithaca, NY  14853
Phone: 607.255.9571
Fax: 607.255.0939


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message