Author: markt
Date: Fri Nov 22 10:05:31 2013
New Revision: 1544460

URL: http://svn.apache.org/r1544460
Log:
Separate validation of *.jspx and *.tagx files into a new option.

Modified:
    tomcat/trunk/java/org/apache/catalina/Context.java
    tomcat/trunk/java/org/apache/catalina/Globals.java
    tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
    tomcat/trunk/java/org/apache/catalina/startup/FailedContext.java
    tomcat/trunk/java/org/apache/jasper/Constants.java
    tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
    tomcat/trunk/test/org/apache/catalina/core/TesterContext.java
    tomcat/trunk/webapps/docs/config/context.xml

Modified: tomcat/trunk/java/org/apache/catalina/Context.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Context.java?rev=1544460&r1=1544459&r2=1544460&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Context.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Context.java Fri Nov 22 10:05:31 2013
@@ -591,7 +591,7 @@ public interface Context extends Contain
 
     /**
      * Controls whether the parsing of web.xml and web-fragment.xml files for
-     * this Context be performed by a namespace aware parser.
+     * this Context will be performed by a namespace aware parser.
      *
      * @param xmlNamespaceAware true to enable namespace awareness
      */
@@ -609,7 +609,7 @@ public interface Context extends Contain
 
     /**
      * Controls whether the parsing of web.xml, web-fragment.xml and *.tld 
files
-     * for this Context be performed by a validating parser.
+     * for this Context will be performed by a validating parser.
      *
      * @param xmlValidation true to enable xml validation
      */
@@ -617,6 +617,24 @@ public interface Context extends Contain
 
 
     /**
+     * Will the parsing of *.jspx and *.tagx files for this Context be 
performed
+     * by a validating parser?
+     *
+     * @return true if validation is enabled.
+     */
+    public boolean getXmlValidationJspDoc();
+
+
+    /**
+     * Controls whether the parsing of *.jspx and *.tagx files for this Context
+     * will be performed by a validating parser.
+     *
+     * @param xmlValidationJspDoc true to enable xml validation
+     */
+    public void setXmlValidationJspDoc(boolean xmlValidationJspDoc);
+
+
+    /**
      * Get the Jar Scanner to be used to scan for JAR resources for this
      * context.
      * @return  The Jar Scanner configured for this context.

Modified: tomcat/trunk/java/org/apache/catalina/Globals.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Globals.java?rev=1544460&r1=1544459&r2=1544460&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/Globals.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Globals.java Fri Nov 22 10:05:31 2013
@@ -273,10 +273,20 @@ public final class Globals {
 
     /**
      * Name of the ServletContext attribute that determines if the JSP engine
-     * should validate *.tld, *.jspx and *.tagx files when parsing them.
+     * should validate *.tld files when parsing them.
      * <p>
      * This must be kept in sync with org.apache.japser.Constants
      */
     public static final String JASPER_XML_VALIDATION_ATTR =
             "org.apache.jasper.XML_VALIDATE";
+
+
+    /**
+     * Name of the ServletContext attribute that determines if the JSP engine
+     * should validate *.jspx and *.tagx files when parsing them.
+     * <p>
+     * This must be kept in sync with org.apache.japser.Constants
+     */
+    public static final String JASPER_XML_VALIDATION_DOC_ATTR =
+            "org.apache.jasper.XML_VALIDATE_DOC";
 }

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=1544460&r1=1544459&r2=1544460&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Fri Nov 22 
10:05:31 2013
@@ -695,6 +695,13 @@ public class StandardContext extends Con
 
 
     /**
+     * Attribute value used to turn on/off XML validation for *.jspx and *.tagx
+     * files.
+     */
+    private boolean xmlValidationJspDoc = false;
+
+
+    /**
      * Attribute value used to turn on/off XML namespace validation
      */
     private boolean xmlNamespaceAware = Globals.STRICT_SERVLET_COMPLIANCE;
@@ -6377,6 +6384,18 @@ public class StandardContext extends Con
 
 
     @Override
+    public void setXmlValidationJspDoc(boolean webXmlValidationJspDoc){
+        this.xmlValidationJspDoc = webXmlValidationJspDoc;
+    }
+
+
+    @Override
+    public boolean getXmlValidationJspDoc(){
+        return xmlValidationJspDoc;
+    }
+
+
+    @Override
     public boolean getXmlNamespaceAware(){
         return xmlNamespaceAware;
     }

Modified: tomcat/trunk/java/org/apache/catalina/startup/FailedContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/FailedContext.java?rev=1544460&r1=1544459&r2=1544460&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/FailedContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/FailedContext.java Fri Nov 22 
10:05:31 2013
@@ -456,6 +456,11 @@ public class FailedContext extends Lifec
     public void setXmlValidation(boolean xmlValidation) { /* NO-OP */ }
 
     @Override
+    public boolean getXmlValidationJspDoc() { return false; }
+    @Override
+    public void setXmlValidationJspDoc(boolean xmlValidationJspDoc) { /* NO-OP 
*/ }
+
+    @Override
     public JarScanner getJarScanner() { return null; }
     @Override
     public void setJarScanner(JarScanner jarScanner) { /* NO-OP */ }

Modified: tomcat/trunk/java/org/apache/jasper/Constants.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/Constants.java?rev=1544460&r1=1544459&r2=1544460&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/Constants.java (original)
+++ tomcat/trunk/java/org/apache/jasper/Constants.java Fri Nov 22 10:05:31 2013
@@ -154,9 +154,18 @@ public class Constants {
 
     /**
      * Name of the ServletContext attribute that determines if the XML parsers
-     * used for *.tld, *.jspx and *.tagx files will be validating or not.
+     * used for *.tld files will be validating or not.
      * <p>
      * This must be kept in sync with org.apache.catalina.Globals
      */
     public static final String XML_VALIDATION_ATTR = 
"org.apache.jasper.XML_VALIDATE";
+
+
+    /**
+     * Name of the ServletContext attribute that determines if the XML parsers
+     * used for *.jspx and *.tagx files will be validating or not.
+     * <p>
+     * This must be kept in sync with org.apache.catalina.Globals
+     */
+    public static final String XML_VALIDATION_DOC_ATTR = 
"org.apache.jasper.XML_VALIDATE_DOC";
 }

Modified: tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java?rev=1544460&r1=1544459&r2=1544460&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java 
(original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/JspDocumentParser.java Fri Nov 
22 10:05:31 2013
@@ -166,7 +166,7 @@ class JspDocumentParser
 
             boolean validate = Boolean.parseBoolean(
                     
pc.getJspCompilationContext().getServletContext().getInitParameter(
-                            Constants.XML_VALIDATION_ATTR));
+                            Constants.XML_VALIDATION_DOC_ATTR));
             jspDocParser.isValidating = validate;
 
             // Parse the input

Modified: tomcat/trunk/test/org/apache/catalina/core/TesterContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TesterContext.java?rev=1544460&r1=1544459&r2=1544460&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/core/TesterContext.java (original)
+++ tomcat/trunk/test/org/apache/catalina/core/TesterContext.java Fri Nov 22 
10:05:31 2013
@@ -635,6 +635,16 @@ public class TesterContext implements Co
     }
 
     @Override
+    public boolean getXmlValidationJspDoc() {
+        return false;
+    }
+
+    @Override
+    public void setXmlValidationJspDoc(boolean xmlValidationJspDoc) {
+       // NO-OP
+    }
+
+    @Override
     public void setXmlValidation(boolean xmlValidation) {
         // NO-OP
     }

Modified: tomcat/trunk/webapps/docs/config/context.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/context.xml?rev=1544460&r1=1544459&r2=1544460&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/context.xml (original)
+++ tomcat/trunk/webapps/docs/config/context.xml Fri Nov 22 10:05:31 2013
@@ -532,10 +532,12 @@
 
       <attribute name="xmlValidation" required="false">
         <p>If the value of this flag is <code>true</code>, the parsing of
-        <code>web.xml</code>, <code>web-fragment.xml</code>, 
<code>*.tld</code>,
-        <code>*.jspx</code> and <code>*.tagx</code> files for this web
-        application will use a validating parser. Note that the
-        <code>tagPlugins.xml</code> file (if any) is never parsed using a
+        <code>web.xml</code>, <code>web-fragment.xml</code> and
+        <code>*.tld</code> files for this web application will use a validating
+        parser. Note that validation of <code>*.jspx</code> and
+        <code>*.tagx</code> files is controlled separately by the
+        <strong>xmlValidationJspDoc</strong> attribute and that
+        <code>tagPlugins.xml</code> files (if any) are never parsed using a
         validating parser. If the
         <code>org.apache.catalina.STRICT_SERVLET_COMPLIANCE</code>
         <a href="systemprops.html">system property</a> is set to
@@ -545,6 +547,15 @@
         penalty.</p>
       </attribute>
 
+      <attribute name="xmlValidationJspDoc" required="false">
+        <p>If the value of this flag is <code>true</code>, the parsing of
+        <code>*.jspx</code> and <code>*.tagx</code> files for this web
+        application will use a validating parser. Before enabling this option
+        users should review section JSP.6.2.4 of the JSP 2.3 specification. The
+        default value will be <code>false</code>. Setting this attribute to
+        <code>true</code> will incur a performance penalty.</p>
+      </attribute>
+
 
     </attributes>
 



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

Reply via email to