tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: [tomcat4] url-patterns
Date Fri, 28 Sep 2001 01:50:23 GMT


On Thu, 27 Sep 2001, David Rault wrote:

> Date: Thu, 27 Sep 2001 18:48:24 +0200
> From: David Rault <david.rault@free.fr>
> Reply-To: tomcat-user@jakarta.apache.org
> To: Tomcat User ML <tomcat-user@jakarta.apache.org>
> Subject: [tomcat4] url-patterns
>
> Hi everybody
>
> we (my company)  are currently preparing the deployement of a J2EE 1.3 web
> application under Apache/Tomcat (apache 1.3.20 & tomcat 4 final)
>
> first i will expose my main problem and
> then i'll expose a secondary problem i've found while trying to find a
> solution to the 1st one
>
> --------
>
> My objective is :
> we need to map virtual directories to a specific servlet:
> the url-pattern /*/index.jsp should be mapped to MyApplicationController
> (whatever directory index you call, you must be redirected to
> MyApplicationController)
>
> but tomcat refuses this pattern
>

That's because it is not legal.

> i found out it would only accept : "*.ext" or "/foo/*"-like patterns
>
> does anybody know a way to do what i need ?
>

One approach would be to write a Filter that examined the request URI and
did a RequestDispatcher.forward() to your application controller if it
sees "/index.jsp" on the end.  For all other requests, the filter would
just pass it on unchanged.  Besides being simpler than Apache's
mod_rewrite rules (trust me, it *is* simpler :-), this also has the
advantage of being portable to any Servlet 2.3 container.

Craig McClanahan
kk


Mime
View raw message