This is a patch for RFE# 7564. It allows one to specify/override the
location of the default deployment descriptor. Currently, this is hardcoded
to 'conf/web.xml' in o.a.c.startup.Constants.java

Products that embed the Catalina engine (using Embedded's API) may have a
different directory structure and this patch allows one to programmatically
specify the location of the default deployment descriptor rather than having
to change the value of o.a.c.startup.Constants.defaultWebXml.

e.g.
    StandardContext context = new StandardContext();
    ...
    ...
    ContextConfig config = new ContextConfig();
    config.setDefaultWebXml("/webserver1/config/default-web.xml");
    ((Lifecycle) context).addLifecycleListener(config);

Cheers,
 Arvind
Index: ContextConfig.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
retrieving revision 1.60
diff -u -r1.60 ContextConfig.java
--- ContextConfig.java  14 Mar 2002 23:58:35 -0000      1.60
+++ ContextConfig.java  28 Mar 2002 09:28:12 -0000
@@ -168,6 +168,12 @@
 
 
     /**
+     * The default deployment descriptor location.
+     */
+    private String defaultWebXml = Constants.DefaultWebXml;
+
+
+    /**
      * The string resources for this package.
      */
     private static final StringManager sm =
@@ -213,6 +219,28 @@
     }
 
 
+    /**
+     * Return the location of the default deployment descriptor
+     */
+    public String getDefaultWebXml() {
+
+        return (this.defaultWebXml);
+
+    }
+
+
+    /**
+     * Set the location of the default deployment descriptor
+     *
+     * @param path Absolute/relative path to the 'default' web.xml
+     */
+    public void setDefaultWebXml(String path) {
+
+        this.defaultWebXml = path;
+
+    }
+
+
     // --------------------------------------------------------- Public Methods
 
 
@@ -480,10 +508,10 @@
     private void defaultConfig() {
 
         // Open the default web.xml file, if it exists
-        File file = new File(Constants.DefaultWebXml);
+        File file = new File(this.defaultWebXml);
         if (!file.isAbsolute())
             file = new File(System.getProperty("catalina.base"),
-                            Constants.DefaultWebXml);
+                            this.defaultWebXml);
         FileInputStream stream = null;
         try {
             stream = new FileInputStream(file.getCanonicalPath());
Index: ContextConfig.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v
retrieving revision 1.60
diff -u -r1.60 ContextConfig.java
--- ContextConfig.java  14 Mar 2002 23:58:35 -0000      1.60
+++ ContextConfig.java  28 Mar 2002 09:28:12 -0000
@@ -168,6 +168,12 @@
 
 
     /**
+     * The default deployment descriptor location.
+     */
+    private String defaultWebXml = Constants.DefaultWebXml;
+
+
+    /**
      * The string resources for this package.
      */
     private static final StringManager sm =
@@ -213,6 +219,28 @@
     }
 
 
+    /**
+     * Return the location of the default deployment descriptor
+     */
+    public String getDefaultWebXml() {
+
+        return (this.defaultWebXml);
+
+    }
+
+
+    /**
+     * Set the location of the default deployment descriptor
+     *
+     * @param path Absolute/relative path to the 'default' web.xml
+     */
+    public void setDefaultWebXml(String path) {
+
+        this.defaultWebXml = path;
+
+    }
+
+
     // --------------------------------------------------------- Public Methods
 
 
@@ -480,10 +508,10 @@
     private void defaultConfig() {
 
         // Open the default web.xml file, if it exists
-        File file = new File(Constants.DefaultWebXml);
+        File file = new File(this.defaultWebXml);
         if (!file.isAbsolute())
             file = new File(System.getProperty("catalina.base"),
-                            Constants.DefaultWebXml);
+                            this.defaultWebXml);
         FileInputStream stream = null;
         try {
             stream = new FileInputStream(file.getCanonicalPath());

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

Reply via email to