costin      01/07/26 21:00:19

  Modified:    src/share/org/apache/tomcat/modules/config
                        ServerXmlReader.java
  Log:
  I'm after config problems, this is a small fix in server.xml reading.
  
  We need to collect all modules declarations from modules.xml, so
  context.xml doesn't have to read them again. However while reading
  server.xml we don't need to add them again.
  
  This is important as <module> declaration could happen inside server.xml
  ( or another file that defines/configures modules ). There's no need
  to edit both modules.xml and server.xml.
  
  Revision  Changes    Path
  1.14      +13 -9     
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ServerXmlReader.java
  
  Index: ServerXmlReader.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ServerXmlReader.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ServerXmlReader.java      2001/07/19 05:53:07     1.13
  +++ ServerXmlReader.java      2001/07/27 04:00:18     1.14
  @@ -129,7 +129,7 @@
        setPropertiesRules( cm, xh );
        setTagRules( xh );
        addDefaultTags(cm, xh);
  -     addTagRules( cm, xh );
  +     //addTagRules( cm, xh );
        setBackward( xh );
   
        // load the config file(s)
  @@ -165,7 +165,7 @@
   
       // -------------------- Xml reading details --------------------
   
  -    public static void loadConfigFile(XmlMapper xh, File f, ContextManager cm)
  +    public static void loadConfigFile(XmlMapper xh, File f, Object cm)
        throws TomcatException
       {
        try {
  @@ -229,16 +229,19 @@
            String tag=(String)keys.nextElement();
            String classN=(String)modules.get( tag );
   
  -         xh.addRule( tag ,
  -                     xh.objectCreate( classN, null ));
  -         xh.addRule( tag ,
  -                     xh.setProperties());
  -         xh.addRule( tag,
  -                     xh.addChild( "addInterceptor",
  -                                  "org.apache.tomcat.core.BaseInterceptor"));
  +         addTagRule( xh, tag, classN );
        }
       }
   
  +    public static void addTagRule( XmlMapper xh, String tag, String classN ) {
  +     xh.addRule( tag ,
  +                 xh.objectCreate( classN, null ));
  +     xh.addRule( tag ,
  +                 xh.setProperties());
  +     xh.addRule( tag,
  +                 xh.addChild( "addInterceptor",
  +                              "org.apache.tomcat.core.BaseInterceptor"));
  +    }
   
       public static void setTagRules( XmlMapper xh ) {
        xh.addRule( "module",  new XmlAction() {
  @@ -251,6 +254,7 @@
                    ContextManager cm=(ContextManager)ctx.currentObject();
                    Hashtable modules=(Hashtable)cm.getNote("modules");
                    modules.put( name, classN );
  +                 addTagRule( ctx.getMapper(), name, classN );
                    if( ctx.getDebug() > 0 ) ctx.log("Adding " + name + " " + classN );
                }
            });
  
  
  

Reply via email to