luehe       2003/09/17 16:26:33

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardWrapper.java
  Log:
  Fix for Bugtraq 4924326 ("JMX registrations of servlets that map to
  the same jsp-file use the same name")
  
  This allows for the following 2 servlets, which map to the same
  jsp-file, to be distinguished.
  
      <servlet>
          <servlet-name>xxx</servlet-name>
          <jsp-file>/jsp/test.jsp</jsp-file>
      </servlet>
  
      <servlet>
          <servlet-name>yyy</servlet-name>
          <jsp-file>/jsp/test.jsp</jsp-file>
      </servlet>
  
      <servlet-mapping>
          <servlet-name>xxx</servlet-name>
          <url-pattern>/xxx</url-pattern>
      </servlet-mapping>
  
      <servlet-mapping>
          <servlet-name>yyy</servlet-name>
          <url-pattern>/yyy</url-pattern>
      </servlet-mapping>
  
  Without the fix, accessing "/xxx" causes a 404, because its
  registration is overridden by the 2nd servlet, so that "/xxx" is
  handled by the DefaultServlet.
  
  Revision  Changes    Path
  1.32      +5 -9      
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapper.java
  
  Index: StandardWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- StandardWrapper.java      29 Jul 2003 15:55:15 -0000      1.31
  +++ StandardWrapper.java      17 Sep 2003 23:26:33 -0000      1.32
  @@ -1607,17 +1607,13 @@
   
       protected void registerJMX(StandardContext ctx) {
           try {
  -            String name=this.getJspFile();
  -            if( name==null ) {
  -                name=this.getServletName();
  -            }
               // it should be full name
               String parentName=ctx.getName();
               String hostName=ctx.getParent().getName();
               String webMod= "//" + ((hostName==null)? "DEFAULT" :hostName ) +
                       (("".equals(parentName) ) ? "/" : parentName );
               String onameStr=ctx.getDomain() + 
  -                    ":j2eeType=Servlet,name=" + name + ",WebModule=" +
  +                    ":j2eeType=Servlet,name=" + getName() + ",WebModule=" +
                       webMod + ",J2EEApplication=" +
                       ctx.getJ2EEApplication() + ",J2EEServer=" +
                       ctx.getJ2EEServer();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to