You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/01/13 14:07:47 UTC

svn commit: r1557701 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/catalina/startup/ContextConfig.java

Author: markt
Date: Mon Jan 13 13:07:47 2014
New Revision: 1557701

URL: http://svn.apache.org/r1557701
Log:
Back-port from XML processing improvements (part 5)
Switch to a per context configuration for the XML digester

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1557701&r1=1557700&r2=1557701&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Mon Jan 13 13:07:47 2014
@@ -61,15 +61,6 @@ PATCHES PROPOSED TO BACKPORT:
       requires Ant >= 1.8.0).
   -1:
 
-* Back-port from XML processing improvements (part 5)
-  Switch to a per context configuration for the XML digester
-  http://people.apache.org/~markt/patches/2014-01-08-xml-prep-part5-tc6-v1.patch
-  +1: markt, kkolinko, remm
-  -1:
-   kkolinko: I see no need for the new non-static "createWebXmlDigester(..)"
-     method to be public. It returns 'void', so it is unlikely for it to be
-     called from outside.
-
 * Back-port from XML processing improvements (part 6)
   Upgrade digester to use DefaultHandler2 and use LexicalHandler to detect
   publicId.

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1557701&r1=1557700&r2=1557701&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java Mon Jan 13 13:07:47 2014
@@ -63,7 +63,7 @@ import org.xml.sax.SAXParseException;
  *
  * @author Craig R. McClanahan
  * @author Jean-Francois Arcand
- * @version $Id:$
+ * @version $Id$
  */
 public class ContextConfig implements LifecycleListener {
 
@@ -147,23 +147,22 @@ public class ContextConfig implements Li
      * The <code>Digester</code> we will use to process web application
      * deployment descriptor files.
      */
-    protected static Digester webDigester = null;
-
-
-    /**
-     * The <code>Rule</code> used to parse the web.xml
-     */
-    protected static WebRuleSet webRuleSet = new WebRuleSet();
+    protected Digester webDigester = null;
+    protected WebRuleSet webRuleSet = null;
 
     /**
      * Attribute value used to turn on/off XML validation
+     * @deprecated Unused. Will be removed in Tomcat 7.0.x.
      */
-     protected static boolean xmlValidation = false;
+    @Deprecated
+    protected static boolean xmlValidation = false;
 
 
     /**
      * Attribute value used to turn on/off XML namespace awarenes.
+     * @deprecated Unused. Will be removed in Tomcat 7.0.x.
      */
+    @Deprecated
     protected static boolean xmlNamespaceAware = false;
 
 
@@ -508,27 +507,16 @@ public class ContextConfig implements Li
 
 
     /**
-     * Create (if necessary) and return a Digester configured to process the
+     * Create and return a Digester configured to process the
      * web application deployment descriptor (web.xml).
      */
-    protected static Digester createWebDigester() {
-        Digester webDigester =
-            createWebXmlDigester(xmlNamespaceAware, xmlValidation);
-        return webDigester;
-    }
-
+    protected void createWebXmlDigester(boolean namespaceAware,
+            boolean validation) {
 
-    /**
-     * Create (if necessary) and return a Digester configured to process the
-     * web application deployment descriptor (web.xml).
-     */
-    public static Digester createWebXmlDigester(boolean namespaceAware,
-                                                boolean validation) {
-
-        Digester webDigester =  DigesterFactory.newDigester(xmlValidation,
-                                                            xmlNamespaceAware,
-                                                            webRuleSet);
-        return webDigester;
+        webRuleSet = new WebRuleSet();
+        webDigester = DigesterFactory.newDigester(validation,
+                namespaceAware, webRuleSet);
+        webDigester.getParser();
     }
 
 
@@ -991,11 +979,6 @@ public class ContextConfig implements Li
     protected void init() {
         // Called from StandardContext.init()
 
-        if (webDigester == null){
-            webDigester = createWebDigester();
-            webDigester.getParser();
-        }
-
         if (contextDigester == null){
             contextDigester = createContextDigester();
             contextDigester.getParser();
@@ -1015,6 +998,8 @@ public class ContextConfig implements Li
                     "contextConfig.fixDocBase", context.getPath()), e);
         }
 
+        createWebXmlDigester(context.getXmlNamespaceAware(),
+                context.getXmlValidation());
     }
 
 
@@ -1041,27 +1026,6 @@ public class ContextConfig implements Li
         if (log.isDebugEnabled())
             log.debug(sm.getString("contextConfig.start"));
 
-        // Set properties based on DefaultContext
-        Container container = context.getParent();
-        if( !context.getOverride() ) {
-            if( container instanceof Host ) {
-                // Reset the value only if the attribute wasn't
-                // set on the context.
-                xmlValidation = context.getXmlValidation();
-                if (!xmlValidation) {
-                    xmlValidation = ((Host)container).getXmlValidation();
-                }
-
-                xmlNamespaceAware = context.getXmlNamespaceAware();
-                if (!xmlNamespaceAware){
-                    xmlNamespaceAware
-                                = ((Host)container).getXmlNamespaceAware();
-                }
-
-                container = container.getParent();
-            }
-        }
-
         // Process the default and application web.xml files
         defaultWebConfig();
         applicationWebConfig();



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