tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <Yoav.Shap...@mpi.com>
Subject RE: Servlet mapping problem
Date Wed, 29 Sep 2004 13:04:32 GMT

Hi,

>However, I am sure about the fact, that you cannot map a single url
such as
>"/".
>(Yes, you can define a mapping of "/", but that maps to EVERY request,
NOT
>to the root url only.)

No.  You're mistaking the default configuration for something that's
hard-coded.  Out of the box, "/" is mapped to Tomcat's DefaultServlet,
which handles static content.  This is routine for other containers as
well and is not a particular Tomcat trick.  

Per the servlet spec, / is the default mapping also, so anything that's
not matched by other mappings will end up there.

So, here's one way to change things:
- Explicitly map the things you want handled by Tomcat's DefaultServlet
to it, e.g.
<servlet-name>DefaultServlet</servlet-name><url-pattern>*.html</url-patt
ern>.  Same for *.htm, *.gif, *.jpg, *.png, etc.
- Map any servlet of your choice to URL pattern /.
- Ensure that rest of your app has no unmapped pages, i.e. ones that'll
propagate to /.

Yoav



This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.


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


Mime
View raw message