tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Kandzior <>
Subject How to configure prefix mapping to override extension mapping?
Date Sun, 17 Jun 2001 11:34:29 GMT
Hi all,

the question is: How do I configure a webapp in Tomcat so that a prefix
mapping for a servlet "overrides" an extension mapping?

Here's what I want to do:

I have a servlet, "TestServlet". This is configured and works as it should.
What the servlet actually does is of not important for the problem.
Configuration in web.xml is straigthforward:


What I want is that all requests that start with /TestServlet/ should be
handled by my servlet INCLUDING requests like "/TestServlet/foo.jsp",
treating the "/foo.jsp" as path information (ie. parameter) of my servlet.
However, that dosen't work because the extension mapping for "*.jsp" always
overrides the prefix mapping for the servlet. That's exactly what I do NOT
want. I want all requests that start with the "/TestServlet" prefix to be
handled by my servlet, while all other requests that end with *.jsp are
handled should be handled by the JSP engine.

In short:
/TestServlet: maps to my servlet (fine)
/TestServlet/foo: maps to my servlet, "/foo" being delivered as path
information (fine)
/TestServlet/foo.jsp: Does not map to my servlet but to the JSP servlet
(that's my problem)

Actually, the Servlet 2.2 Spec is not clear on this point. It dosen't say
what's supposed to happen if there is a prefix match AND an extension match
in the same URI. It seems that Tomcat finds both matches (I turend on the
debug log), but for some inobvious reason then always uses the extension

Is there a way to control the order of the matching process so that can I
can change this behavior and use the prefix mapping in such a case? Any help
is appreciated.


View raw message