Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@jakarta.apache.org Received: (qmail 46533 invoked by uid 500); 28 Sep 2001 01:51:18 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk Reply-To: tomcat-user@jakarta.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 46503 invoked from network); 28 Sep 2001 01:51:17 -0000 Date: Thu, 27 Sep 2001 18:50:23 -0700 (PDT) From: "Craig R. McClanahan" Sender: To: Tomcat User ML Subject: Re: [tomcat4] url-patterns In-Reply-To: <018b01c14774$39e8c8a0$710110ac@nagoratechnologies.com> Message-ID: <20010927184759.V86138-100000@localhost> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Rating: localhost 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Thu, 27 Sep 2001, David Rault wrote: > Date: Thu, 27 Sep 2001 18:48:24 +0200 > From: David Rault > Reply-To: tomcat-user@jakarta.apache.org > To: Tomcat User ML > 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