tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Servlet mapping question -- way to include everythign EXCEPT a directory?
Date Thu, 01 Jul 2010 17:35:50 GMT
Caldarale, Charles R wrote:
>> From: laredotornado [mailto:laredotornado@gmail.com]
>> Subject: RE: Servlet mapping question -- way to include everythign
>> EXCEPT a directory?
>>
>> I like your idea about specifying the DefaultServlet, 
>> but what do you mean by the "DefaultServlet" ?
> 
> Tomcat's built-in servlet that handles all static content.  It's defined in the global
conf/web.xml, and thus included in all deployed webapps:
> 
> <servlet>
>   <servlet-name>default</servlet-name>
>   <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
> ...snip...
> </servlet>
> 
> It has this mapping:
> 
> <servlet-mapping>
>   <servlet-name>default</servlet-name>
>   <url-pattern>/</url-pattern>
> </servlet-mapping>
> 
> so it gets to process anything that doesn't match any other mapping.  Just add this to
your webapp's WEB-INF/web.xml:
> 
> <servlet-mapping>
>   <servlet-name>default</servlet-name>
>   <url-pattern>/play/sports/includes/*</url-pattern>
> <servlet-mapping>
> 
>  - Chuck
> 
> 
If it isn't yet the case, this might be worth a short Wiki article, including the short 
explanation above.  While it is true that this can be derived from the page at
http://tomcat.apache.org/tomcat-6.0-doc/default-servlet.html
I still believe it is not so evident for a beginner.
That page gives a complicated example to do with listings, but the OP's question is in 
fact a fairly basic and recurrent one.

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


Mime
View raw message