From: markt Date: Thu, 19 May 2011 10:44:12 +0000 (+0000) Subject: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51220 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=dad60f90a0e3f1da29a715e4e795e7df97fd5ebe;p=tomcat7.0 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. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1124680 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java index 4cec63cc9..4ffe988b6 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -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; diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 0f9e8471b..35520ba6d 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -62,6 +62,14 @@ + + + + 51220: Add a system property to enable tag pooling with JSPs + that use a custom base class. Based on a patch by Dan Mikusa. (markt) + + + diff --git a/webapps/docs/config/systemprops.xml b/webapps/docs/config/systemprops.xml index 3167fbbb3..66e4b431b 100644 --- a/webapps/docs/config/systemprops.xml +++ b/webapps/docs/config/systemprops.xml @@ -98,6 +98,20 @@
+ +

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 true will enable pooling with an alternative base + class. If the alternative base class does not call _jspInit() and this + property is true, NPEs will occur when attempting to use + tags.

+

If not specified, the default value of false will be used. +

+
+

If true, the requirement to have the object referenced in jsp:getProperty action to be previously "introduced"