tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1489648 - in /tomcat/trunk/java/org/apache/catalina: core/StandardContext.java startup/HostConfig.java
Date Tue, 04 Jun 2013 21:55:06 GMT
Author: markt
Date: Tue Jun  4 21:54:48 2013
New Revision: 1489648

URL: http://svn.apache.org/r1489648
Log:
Add the ability for a context.xml file in a webapp to override the default value of copyXML
on the host. There are some 'interesting' edge cases here. Test cases to follow.

Modified:
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1489648&r1=1489647&r2=1489648&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Tue Jun  4 21:54:48 2013
@@ -486,6 +486,12 @@ public class StandardContext extends Con
 
 
     /**
+     * Context level override for default {@link StandardHost#isCopyXML()}.
+     */
+    private boolean copyXML = false;
+
+
+    /**
      * The default context override flag for this web application.
      */
     private boolean override = false;
@@ -2376,6 +2382,17 @@ public class StandardContext extends Con
 
     }
 
+
+    public boolean getCopyXML() {
+        return copyXML;
+    }
+
+
+    public void setCopyXML(boolean copyXML) {
+        this.copyXML = copyXML;
+    }
+
+
     /**
      * Return the Java class name of the Wrapper implementation used
      * for servlets registered in this Context.

Modified: tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=1489648&r1=1489647&r2=1489648&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Tue Jun  4 21:54:48 2013
@@ -53,6 +53,7 @@ import org.apache.catalina.Lifecycle;
 import org.apache.catalina.LifecycleEvent;
 import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.Manager;
+import org.apache.catalina.core.StandardContext;
 import org.apache.catalina.core.StandardHost;
 import org.apache.catalina.util.ContextName;
 import org.apache.catalina.util.IOTools;
@@ -892,14 +893,10 @@ public class HostConfig
                 copyThisXml = ((StandardHost) host).isCopyXML();
             }
 
-            /**
-             * TODO
-             *
             // If Host is using default value Context can override it.
             if (!copyXML && context instanceof StandardContext) {
                 copyXML = ((StandardContext) context).getCopyXML();
             }
-            */
 
             if (xmlInWar && copyThisXml) {
                 // Change location of XML file to config base
@@ -1084,8 +1081,7 @@ public class HostConfig
                 new File(host.getConfigBaseFile(), cn.getBaseName() + ".xml");
 
 
-        DeployedApplication deployedApp = new DeployedApplication(cn.getName(),
-                xml.exists() && deployXML && copyXML);
+        DeployedApplication deployedApp;
 
         try {
             if (deployXML && xml.exists()) {
@@ -1103,6 +1099,12 @@ public class HostConfig
                         digester.reset();
                     }
                 }
+
+                if (copyXML == false && context instanceof StandardContext) {
+                    // Host is using default value. Context may override it.
+                    copyXML = ((StandardContext) context).getCopyXML();
+                }
+
                 if (copyXML) {
                     InputStream is = null;
                     OutputStream os = null;
@@ -1146,6 +1148,9 @@ public class HostConfig
             log.error(sm.getString("hostConfig.deployDir.error",
                     dir.getAbsolutePath()), t);
         } finally {
+            deployedApp = new DeployedApplication(cn.getName(),
+                    xml.exists() && deployXML && copyXML);
+
             // Fake re-deploy resource to detect if a WAR is added at a later
             // point
             deployedApp.redeployResources.put(dir.getAbsolutePath() + ".war",



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message