Add a system property to enable tag pooling with JSPs that use a custom base class.
Based on a patch by Dan Mikusa.
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@
1124680 13f79535-47bb-0310-9956-
ffa450edef68
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"
* 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;
</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>
<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"