Return-Path: Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 83949 invoked from network); 11 Sep 2000 15:52:54 -0000 Received: from mercury.sun.com (192.9.25.1) by locus.apache.org with SMTP; 11 Sep 2000 15:52:54 -0000 Received: from taller.eng.sun.com ([129.144.124.34]) by mercury.Sun.COM (8.9.3+Sun/8.9.3) with ESMTP id IAA16772 for ; Mon, 11 Sep 2000 08:52:51 -0700 (PDT) Received: from eng.sun.com (florence [129.144.251.146]) by taller.eng.sun.com (8.9.3+Sun/8.9.3/ENSMAIL,v1.7) with ESMTP id IAA01974 for ; Mon, 11 Sep 2000 08:52:49 -0700 (PDT) Message-ID: <39BD000E.16DBF52F@eng.sun.com> Date: Mon, 11 Sep 2000 08:53:50 -0700 From: "Craig R. McClanahan" X-Mailer: Mozilla 4.75 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: tomcat-dev@jakarta.apache.org Subject: Re: Servlet-names are mappings !! References: <009701c01bc9$d7a40140$3301a8c0@pacbell.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N 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: MyServlet com.mycompany.mypackage.MyServlet MyServlet /runmyservlet/* Now, if you use this URL: http://localhost:8080/contextpath/runmyservlet 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: http://localhost:8080/contextpath/servlet/com.mycompany.mypackage.MyServlet http://localhost:8080/contextpath/servlet/MyServlet 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 definitions at all. The invoker tries to match what is entered after "/servlet" to either a or , 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 easy: * Tomcat 3.1 or 4.0 : remove the for the invoker servlet from file $TOMCAT_HOME/conf/web.xml * Tomcat 3.2: remove the 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