tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cos...@apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ContextXmlReader.java
Date Sun, 11 Feb 2001 02:26:05 GMT
costin      01/02/10 18:26:05

  Modified:    src/share/org/apache/tomcat/modules/config
                        ContextXmlReader.java
  Log:
  Fixed few issues with per/context interceptors and the new
  syntax.
  
  Revision  Changes    Path
  1.4       +53 -2     jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ContextXmlReader.java
  
  Index: ContextXmlReader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/ContextXmlReader.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ContextXmlReader.java	2001/02/10 16:42:46	1.3
  +++ ContextXmlReader.java	2001/02/11 02:26:04	1.4
  @@ -108,8 +108,8 @@
   	xh.setDebug( debug );
   
   	// use the same tags for context-local modules
  -	ServerXmlReader.setTagRules( xh );
  -	ServerXmlReader.addDefaultTags(cm, xh);
  +	setTagRules( xh );
  +	addDefaultTags(cm, xh);
   	setContextRules( xh );
   	setBackward( xh );
   
  @@ -209,5 +209,56 @@
   		   xh.addChild("setServletLogger",
   			       "org.apache.tomcat.util.log.Logger") );
       }
  +
  +    // --------------------
  +    
  +    public static void setTagRules( XmlMapper xh ) {
  +	xh.addRule( "module",  new XmlAction() {
  +		public void start(SaxContext ctx ) throws Exception {
  +		    Object elem=ctx.currentObject();
  +		    AttributeList attributes = ctx.getCurrentAttributes();
  +		    String name=attributes.getValue("name");
  +		    String classN=attributes.getValue("javaClass");
  +		    if( name==null || classN==null ) return;
  +		    XmlMapper mapper=ctx.getMapper();
  +		    ContextXmlReader.addTag( mapper, name, classN );
  +		}
  +	    });
  +    }
  +
  +    // read modules.xml, if any, and load taskdefs
  +    public static  void addDefaultTags( ContextManager cm,
  +					XmlMapper xh)
  +	throws TomcatException
  +    {
  +	File f=new File( cm.getHome(), "/conf/modules.xml");
  +	if( f.exists() ) {
  +	    //            cm.setNote( "configFile", f.getAbsoluteFile());
  +	    //	    cm.setNote( "modules", new Hashtable());
  +	    ServerXmlReader.loadConfigFile( xh, f, cm );
  +            // load module-*.xml
  +            Vector v = ServerXmlReader.getUserConfigFiles(f);
  +            for (Enumeration e = v.elements();
  +                 e.hasMoreElements() ; ) {
  +                f = (File)e.nextElement();
  +                ServerXmlReader.loadConfigFile(xh,f,cm);
  +            }
  +	}
  +    }
  +
  +    // similar with ant's taskdef
  +    public static void addTag( XmlMapper xh, String tag, String classN) {
  +
  +	tag="Context" + "/" + tag;
  +	xh.addRule(  tag ,
  +		    xh.objectCreate( classN, null ));
  +	xh.addRule( tag ,
  +		    xh.setProperties());
  +	xh.addRule( tag,
  +		    xh.addChild( "addInterceptor",
  +				 "org.apache.tomcat.core.BaseInterceptor"));
  +    }
  +
  +
   }
   
  
  
  

Mime
View raw message