Author: markt
Date: Thu May 19 10:44:12 2011
New Revision: 1124680

URL: http://svn.apache.org/viewvc?rev=1124680&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51220
Add a system property to enable tag pooling with JSPs that use a custom base 
class.
Based on a patch by Dan Mikusa.

Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/Generator.java
    tomcat/trunk/webapps/docs/changelog.xml
    tomcat/trunk/webapps/docs/config/systemprops.xml

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Generator.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Generator.java?rev=1124680&r1=1124679&r2=1124680&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Generator.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Generator.java Thu May 19 
10:44:12 2011
@@ -77,6 +77,8 @@ class Generator {
         
System.getProperty("org.apache.jasper.compiler.Generator.VAR_EXPRESSIONFACTORY",
 "_el_expressionfactory");
     private static final String VAR_INSTANCEMANAGER =
         
System.getProperty("org.apache.jasper.compiler.Generator.VAR_INSTANCEMANAGER", 
"_jsp_instancemanager");
+    private static final boolean POOL_TAGS_WITH_EXTENDS =
+        
Boolean.getBoolean("org.apache.jasper.compiler.Generator.VAR_EXPRESSIONFACTORY");
 
     /* System property that controls if the requirement to have the object
      * used in jsp:getProperty action to be previously "introduced"
@@ -3423,7 +3425,7 @@ class Generator {
          * clarify whether containers can override init() and destroy(). For
          * now, we just disable tag pooling for pages that use "extends".
          */
-        if (pageInfo.getExtends(false) == null) {
+        if (pageInfo.getExtends(false) == null || POOL_TAGS_WITH_EXTENDS) {
             isPoolingEnabled = ctxt.getOptions().isPoolingEnabled();
         } else {
             isPoolingEnabled = false;

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1124680&r1=1124679&r2=1124680&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Thu May 19 10:44:12 2011
@@ -62,6 +62,14 @@
       </add>
     </changelog>
   </subsection>
+  <subsection name="Jasper">
+    <changelog>
+      <add>
+        <bug>51220</bug>: Add a system property to enable tag pooling with JSPs
+        that use a custom base class. Based on a patch by Dan Mikusa. (markt)
+      </add>
+    </changelog>
+  </subsection>
   <subsection name="Cluster">
     <changelog>
       <fix>

Modified: tomcat/trunk/webapps/docs/config/systemprops.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/config/systemprops.xml?rev=1124680&r1=1124679&r2=1124680&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/config/systemprops.xml (original)
+++ tomcat/trunk/webapps/docs/config/systemprops.xml Thu May 19 10:44:12 2011
@@ -98,6 +98,20 @@
 <section name="Jasper">
   <properties>
 
+    <property name="org.apache.jasper.compiler. 
Generator.POOL_TAGS_WITH_EXTENDS">
+      <p>By default, JSPs that use their own base class via the extends
+      attribute of the page directive, will have Tag pooling disabled since
+      Jasper cannot guarantee that the necessary initialisation will have taken
+      place. This can have a negative impact on performance. Providing the
+      alternative base class calls _jspInit() from Servlet.init(), setting  
this
+      property to <code>true</code> will enable pooling with an alternative 
base
+      class. If the alternative base class does not call _jspInit() and this
+      property is <code>true</code>, NPEs will occur when attempting to use
+      tags.</p>
+      <p>If not specified, the default value of <code>false</code> will be 
used.
+      </p>
+    </property>
+
     <property name="org.apache.jasper.compiler. Generator.STRICT_GET_PROPERTY">
       <p>If <code>true</code>, the requirement to have the object referenced in
       <code>jsp:getProperty</code> action to be previously "introduced"



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

Reply via email to