remm        2003/06/15 06:10:41

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardContext.java
  Log:
  - Move context descriptors to
    $CATALINA_BASE/conf/<engine name>/<host name>, as proposed by Glenn.
  - This should make the feature secure, and I think there's no justification
    anymore for the deployXML flag.
  - Note: The manager webapp may need a few updates, which are in progress.
  
  Revision  Changes    Path
  1.65      +33 -6     
jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java
  
  Index: StandardContext.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- StandardContext.java      15 Jun 2003 07:09:10 -0000      1.64
  +++ StandardContext.java      15 Jun 2003 13:10:40 -0000      1.65
  @@ -3866,19 +3866,19 @@
           boolean ok = true;
   
           // Set config file name
  -        String appBase = getAppBase();
  -        if ((getConfigFile() == null) && (appBase != null)) {
  +        File configBase = getConfigBase();
  +        if ((getConfigFile() == null) && (configBase != null)) {
   
               String name = getName();
               if (name.equals("")) {
                   name = "ROOT";
               }
  -            File file = new File(appBase);
  -            file = new File(file, name + ".xml");
  +            File file = new File(configBase, name + ".xml");
   
               setConfigFile(file.getPath());
  -            if( log.isDebugEnabled() )
  +            if (log.isDebugEnabled())
                   log.debug( "Set config file " + file);
  +
           }
   
           // Add missing components as necessary
  @@ -4542,6 +4542,33 @@
               appBase = ((Host) container).getAppBase();
           }
           return appBase;
  +    }
  +
  +
  +    /**
  +     * Get config base.
  +     */
  +    private File getConfigBase() {
  +        File configBase = 
  +            new File(System.getProperty("catalina.base"), "conf");
  +        Container container = this;
  +        Container host = null;
  +        Container engine = null;
  +        while (container != null) {
  +            if (container instanceof Host)
  +                host = container;
  +            if (container instanceof Engine)
  +                engine = container;
  +            container = container.getParent();
  +        }
  +        if (engine != null) {
  +            configBase = new File(configBase, engine.getName());
  +        }
  +        if (host != null) {
  +            configBase = new File(configBase, host.getName());
  +        }
  +        configBase.mkdirs();
  +        return configBase;
       }
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to