tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Servlet-names are mappings !!
Date Mon, 11 Sep 2000 15:53:50 GMT
Jim Rudnicki wrote:

> I noticed this, but thought it was just the way it should be.
> When you name a servlet to provide init parameters, but do not provide a
> mapping, the name is a mapping.
> > > The conclusion is: servlet-name values can, probably sometimes, be used
> as
> > > url-mappings !!
> > >
> > It has nothing to do with documentation, this shouldn't happen.
> >

More precisely, let's assume you have a servlet definition like this:



Now, if you use this URL:


you will execute your servlet due to the servlet mapping entry.

In a standard Tomcat installation, you will find that the following two URLs
also work:



These work because of a Tomcat feature (not in the servlet spec) called the
"invoker" servlet.  This feature is very commonly provided by servlet
containers, because in simple situations you will not need to create <servlet>
definitions at all.  The invoker tries to match what is entered after
"/servlet" to either a <servlet-class> or <servlet-name>, and then executes the
corresponding servlet for you.

How does this work?  Simple:  the invoker servlet itself is mapped to
url-pattern "/servlet/*".  If you want to remove this facility, it's pretty

* Tomcat 3.1 or 4.0 :  remove the <servlet-mapping> for the invoker servlet
  from file $TOMCAT_HOME/conf/web.xml

* Tomcat 3.2: remove the <RequestInterceptor> for InvokerInterceptor
  from file $TOMCAT_HOME/conf/server.xml

Craig McClanahan

See you at ApacheCon Europe <>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat

View raw message