tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5 MapperListener.java
Date Thu, 30 Jan 2003 16:45:27 GMT
remm        2003/01/30 08:45:27

  Modified:    coyote/src/java/org/apache/coyote/tomcat5
                        MapperListener.java
  Log:
  - Handle context unregistration (wrapper unregistration seems irrelevant, and the
    mapper doesn't need them to be individually removed).
  
  Revision  Changes    Path
  1.3       +30 -2     jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/MapperListener.java
  
  Index: MapperListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/MapperListener.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MapperListener.java	30 Jan 2003 14:26:59 -0000	1.2
  +++ MapperListener.java	30 Jan 2003 16:45:27 -0000	1.3
  @@ -189,7 +189,16 @@
                   }
               } else if (notification.getType().equals
                          (MBeanServerNotification.UNREGISTRATION_NOTIFICATION)) {
  -                
  +                String j2eeType = objectName.getKeyProperty("j2eeType");
  +                if (j2eeType != null) {
  +                    if (j2eeType.equals("WebModule")) {
  +                        try {
  +                            unregisterContext(objectName);
  +                        } catch (Throwable t) {
  +                            t.printStackTrace();
  +                        }
  +                    }
  +                }
               }
           }
   
  @@ -283,7 +292,26 @@
       private void unregisterContext(ObjectName objectName)
           throws Exception {
   
  -        // FIXME: Also takes care of host registration
  +        String name = objectName.getKeyProperty("name");
  +
  +        String hostName = null;
  +        String contextName = null;
  +        if (name.startsWith("//")) {
  +            name = name.substring(2);
  +        }
  +        int slash = name.indexOf("/");
  +        if (slash != -1) {
  +            hostName = name.substring(0, slash);
  +            contextName = name.substring(slash);
  +        } else {
  +            return;
  +        }
  +        // Special case for the root context
  +        if (contextName.equals("/")) {
  +            contextName = "";
  +        }
  +
  +        mapper.removeContext(hostName, contextName);
   
       }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message