tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jfarc...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5 MapperListener.java
Date Tue, 17 Feb 2004 22:15:34 GMT
jfarcand    2004/02/17 14:15:34

  Modified:    catalina/src/share/org/apache/coyote/tomcat5
                        MapperListener.java
  Log:
  The defaultHostName may be alias, so we need to also try to find if the registered hosts'
aliases contains the defaultHostName.
  
  Revision  Changes    Path
  1.17      +28 -1     jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/MapperListener.java
  
  Index: MapperListener.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/coyote/tomcat5/MapperListener.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- MapperListener.java	2 Feb 2004 17:35:47 -0000	1.16
  +++ MapperListener.java	17 Feb 2004 22:15:34 -0000	1.17
  @@ -293,7 +293,34 @@
           ObjectName hostName = new ObjectName
               (domain + ":type=Host," + "host=" + defaultHost);
           if (!mBeanServer.isRegistered(hostName)) {
  -            log.warn("Unknown default host: " + defaultHost);
  +
  +            // Get the hosts' list
  +            String onStr = domain + ":type=Host,*";
  +            ObjectName objectName = new ObjectName(onStr);
  +            Set set = mBeanServer.queryMBeans(objectName, null);
  +            Iterator iterator = set.iterator();
  +            String[] aliases;
  +            boolean isRegisteredWithAlias = false;
  +            
  +            while (iterator.hasNext()) {
  +
  +                if (isRegisteredWithAlias) break;
  +            
  +                ObjectInstance oi = (ObjectInstance) iterator.next();
  +                hostName = oi.getObjectName();
  +                aliases = (String[])
  +                    mBeanServer.invoke(hostName, "findAliases", null, null);
  +
  +                for (int i=0; i < aliases.length; i++){
  +                    if (aliases[i].equalsIgnoreCase(defaultHost)){
  +                        isRegisteredWithAlias = true;
  +                        break;
  +                    }
  +                }
  +            }
  +            
  +            if (!isRegisteredWithAlias)
  +                log.warn("Unknown default host: " + defaultHost);
           }
           // This should probablt be called later 
           if( defaultHost != null ) {
  
  
  

---------------------------------------------------------------------
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