tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Turning off /servlet/* mapping?
Date Thu, 07 Dec 2000 19:38:18 GMT
Thom Park wrote:

> Hello,
> this works for specific servlets in specific web-apps. I was curious how to turn off
> 'magic' backwards compatability mapping
> of /servlet/ in general.
> To be honest, I was trying to find where this default mapping is being performed. I
> would have thought if I removed the prefix= attribute from the
> InvokerInterceptor in servlet.xml that would have solved the issue. but that doesn't
> seem to do anything.

If you do not want the invoker functionality at all, simply remove the
entry completely.  If you want to change the prefix that it matches against,
modify the
prefix attribute (removing it just uses the default value of "/servlet/").

> I understand I can craft specific servlet-mappings for each application - what about
> 'standalone' servlets (I.e. those not in web-apps). I can always modifiy
> the ROOT/WEB-INF/web.xml to cover that case, however, If I were to turn off the
> /servlet/ mapping then I wouldn't have to edit all of those web.xml
> files in the web-apps ( and non-webapps).

In a servlet 2.2 environment, there is really no such thing as a "standalone"
servlet by
your definition.  Any request URI that is not matched by one of the installed
webapps is
handled by the ROOT webapp.

> I think what I'm asking here is whether the default mapping for any given servlet is
> "http[s]://<address>:<port>/[webapp]/servlet/[servlet-name]"?

To be pedantic, it is actually


but that is only because the invoker interceptor is installed by default.  If
you remove it,
as described above, the only way a servlet can be invoked is if it matches a
<servlet-mapping> entry in some web application's web.xml file.

NOTE:  The invoker facility is *not* a part of the servlet API specification, so
it is *not*
guaranteed to work (or work identically) in every servlet container.

> It seems to me that, unless I setup a url-pattern then this is the case - I'd just like
> that to be verified so I can stick it in some documentation that I'm writing :-)

The documentation for <url-pattern>, and pretty much everything else about the
web.xml file,
is the Servlet API Specification, which you can download from

> thanks,
> Thom

Craig McClanahan

View raw message