Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 36665 invoked from network); 5 Nov 2001 00:12:27 -0000 Received: from unknown (HELO osaka.betaversion.org) (192.18.49.133) by daedalus.apache.org with SMTP; 5 Nov 2001 00:12:27 -0000 Received: (qmail 11745 invoked from network); 5 Nov 2001 00:14:50 -0000 Received: from nagoya.betaversion.org (192.18.49.131) by osaka.betaversion.org with SMTP; 5 Nov 2001 00:14:50 -0000 Received: (qmail 556 invoked by uid 97); 5 Nov 2001 00:12:03 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 540 invoked by uid 97); 5 Nov 2001 00:12:03 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 527 invoked from network); 5 Nov 2001 00:12:02 -0000 Date: Sun, 4 Nov 2001 16:01:08 -0800 (PST) From: "Craig R. McClanahan" Sender: To: Tomcat Users List Subject: Re: servlet-mappings In-Reply-To: <20011103084032.22753.qmail@sidereal.kz> Message-ID: <20011104155535.Q41754-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 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On 3 Nov 2001, Dr. Evil wrote: > Date: 3 Nov 2001 08:40:32 -0000 > From: Dr. Evil > Reply-To: Tomcat Users List > To: tomcat-user@jakarta.apache.org > Subject: servlet-mappings > > > I'm trying to do some fancy stuff with servlet mappings. This > mechanism leaves a lot to be desired; specificly, it would be > amazingly useful to be able to do a getRequestDispatcher in some way > that bypasses the servlet mappings in the web.xml file. Such as ServletContext.getNamedDispatcher()? > Alternatively > it would be extremely useful to be able to call the jsp servlet from > within another servlet, but this doesn't seem to be possible. rd = > request.getRequestDispatcher("jsp") never seems to work. > This would work with the named dispatcher method above, but what are you trying to do with it? Since you're not referencing a particular JSP page, getting a dispatcher to the JSP servlet isn't particularly useful for anything. (Besides, there is not necessarily any such a thing as "the JSP servlet" on other containers, so you are locking yourself in to Tomcat). > Anyway, here's the question: > > I know there are prefix mappings, such as /foo/bar/, and extension > mappings such as *.foo, but it doesn't seem like it's possible to do > mappings like /foo/bar/*.baz. This mapping seems to never hit. Is > there a way to do that? > The legal mappings are those defined in the Servlet Specification, which I've given you the URL for before (hint hint :-). http://java.sun.com/products/servlet/download.html As you will find, patterns like "/foo/bar/*.baz" are not legal servlet mapping patterns. In a servlet 2.3 environment, one option you have is to define a Filter that is mapped to "/*" (i.e. it will process every request to this web app). In your Filter, you can examine the request URI and use a request dispatcher to forward to whatever servlet you like (and totally bypass the mappings of the servlet container itself). Although most Filters pass the request on to the rest of the chain, this is *not* required. Effectively, your filter would define exactly the mappings *you* want. And, because Filters are portable, you would not be locked in to a particular container. Craig -- To unsubscribe: For additional commands: Troubles with the list: