You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by la...@apache.org on 2001/12/05 12:19:07 UTC

cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config ServerXmlReader.java

larryi      01/12/05 03:19:06

  Modified:    src/share/org/apache/tomcat/modules/config
                        ServerXmlReader.java
  Log:
  Added a "tomcat.install" predefined property.
  
  Since all other server.xml tags start with a capital letter, added support for
  <Property ... /> and kept the <property ... /> for backwards compatibility.
  
  Revision  Changes    Path
  1.18      +23 -1     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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ServerXmlReader.java	2001/08/21 05:11:45	1.17
  +++ ServerXmlReader.java	2001/12/05 11:19:06	1.18
  @@ -190,6 +190,9 @@
   	    if( "tomcat.home".equals( key ) ) {
   		return cm.getHome();
   	    }
  +            if( "tomcat.install".equals( key ) ) {
  +                return cm.getInstallDir();
  +	    }
   	    // XXX add other "predefined" properties
   	    String s=cm.getProperty( key );
   	    if( s==null )
  @@ -203,7 +206,26 @@
       {
   	CMPropertySource propS=new CMPropertySource( cm );
   	xh.setPropertySource( propS );
  -	
  +
  +        // add the "correct" first-letter-capitalized version
  +        xh.addRule( "ContextManager/Property", new XmlAction() {
  +                public void start(SaxContext ctx ) throws Exception {
  +                    AttributeList attributes = ctx.getCurrentAttributes();
  +                    String name=attributes.getValue("name");
  +                    String value=attributes.getValue("value");
  +                    if( name==null || value==null ) return;
  +                    XmlMapper xm=ctx.getMapper();
  +
  +                    ContextManager cm1=(ContextManager)ctx.currentObject();
  +                    // replace ${foo} in value
  +                    value=xm.replaceProperties( value );
  +                    if( cm1.getDebug() > 0 )
  +                        cm1.log("Setting " + name + "=" + value);
  +                    cm1.setProperty( name, value );
  +                }
  +            });
  +
  +        // for backward compatibility, keep old version
   	xh.addRule( "ContextManager/property", new XmlAction() {
   		public void start(SaxContext ctx ) throws Exception {
   		    AttributeList attributes = ctx.getCurrentAttributes();
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>