You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2002/11/29 15:44:15 UTC

cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardContext.java

remm        2002/11/29 06:44:15

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardContext.java
  Log:
  - Always set configFile, so that Context information is never saved in server.xml
    (which I think is very hard to work with, and cannot be reloaded).
  
  Revision  Changes    Path
  1.10      +34 -4     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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StandardContext.java	23 Oct 2002 19:57:30 -0000	1.9
  +++ StandardContext.java	29 Nov 2002 14:44:15 -0000	1.10
  @@ -3596,6 +3596,18 @@
           setConfigured(false);
           boolean ok = true;
   
  +        // Set config file name
  +        if (getConfigFile() == null) {
  +            String appBase = getAppBase();
  +            String name = getName();
  +            if (name.equals("")) {
  +                name = "ROOT";
  +            }
  +            File file = new File(appBase);
  +            file = new File(file, name + ".xml");
  +            setConfigFile(file.getPath());
  +        }
  +
           // Add missing components as necessary
           if (webappResources == null) {   // (1) Required by Loader
               if (debug >= 1)
  @@ -4055,6 +4067,24 @@
               }
           }
           return docBase;
  +    }
  +
  +
  +    /**
  +     * Get app base.
  +     */
  +    private String getAppBase() {
  +        String appBase = null;
  +        Container container = this;
  +        while (container != null) {
  +            if (container instanceof Host)
  +                break;
  +            container = container.getParent();
  +        }
  +        if (container != null) {
  +            appBase = ((Host) container).getAppBase();
  +        }
  +        return appBase;
       }
   
   
  
  
  

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