tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Moore" <tmo...@blackboard.com>
Subject RE: * * * Tomcat 4.1.12 & Servlets * * *
Date Mon, 21 Oct 2002 17:23:10 GMT
> -----Original Message-----
> From: Romualdo Rubens de Freitas [mailto:romualdo@unipar.br] 
> Sent: Monday, October 21, 2002 1:02 PM
> To: 'tomcat-user@jakarta.apache.org'
> Subject: * * * Tomcat 4.1.12 & Servlets * * *
> 
> 
> Hi All,
> 
> In web.xml file located at webapps\ROOT\WEB-INF I put the 
> following: <servlet>
>   <servlet-name>Example</servlet-name>
>   <servlet-class>ExampleServlet</servlet-class>
> </servlet>
> 
> After that, I tried to run my HTML file that calls the 
> servlet and I got: (It doesn't matter if I use "Example" or 
> "ExampleServlet")
> * * * * *
> HTTP Status 404 - /servlet/Example
> --------------------------------------------------------------
> ----------
> type Status report
> 
> message /servlet/Example
> 
> description The requested resource (/servlet/Example) is not 
> available.
> * * * * *

This is because the invoker servlet is disabled by default in 4.1.12.
The invoker servlet used to handle all requests starting with
"/servlet".  It has some security concerns, and it's now recommended not
to rely on it.

> 
> If I change web.xml file to add the following: <servlet-mapping>
>   <servlet-name>Example</servlet-name>
>   <url-pattern>/</url-pattern>
> </servlet-mapping>
> 
> my servlet (ExampleServlet.clas) is called without my HTML 
> file be executed.

This is because now you have your servlet set up to handle *all*
requests--including the request for your HTML file.  Try this:

<servlet-mapping>
   <servlet-name>Example</servlet-name>
   <url-pattern>/servlet/Example</url-pattern>
</servlet-mapping>

Then everything should work as expected.

-- 
Tim Moore / Blackboard Inc. / Software Engineer
1899 L Street, NW / 5th Floor / Washington, DC 20036
Phone 202-463-4860 ext. 258 / Fax 202-463-4863

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message