incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r698978 - /incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
Date Thu, 25 Sep 2008 14:13:34 GMT
Author: fmeschbe
Date: Thu Sep 25 07:13:34 2008
New Revision: 698978

URL: http://svn.apache.org/viewvc?rev=698978&view=rev
Log:
SLING-675 Prevent pooling of PageContext objects (see issue for more information)

Modified:
    incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java

Modified: incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java?rev=698978&r1=698977&r2=698978&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
(original)
+++ incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
Thu Sep 25 07:13:34 2008
@@ -43,6 +43,7 @@
 import org.apache.sling.scripting.jsp.jasper.Options;
 import org.apache.sling.scripting.jsp.jasper.compiler.JspRuntimeContext;
 import org.apache.sling.scripting.jsp.jasper.runtime.JspApplicationContextImpl;
+import org.apache.sling.scripting.jsp.jasper.runtime.JspFactoryImpl;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -187,6 +188,9 @@
         Thread.currentThread().setContextClassLoader(jspClassLoader);
 
         try {
+            // prepare some classes
+            prepareJasperClasses();
+            
             ioProvider = new SlingIOProvider(repository);
 
             tldLocationsCache = new SlingTldLocationsCache(slingServletContext,
@@ -297,6 +301,23 @@
             this.repoCLProvider = null;
         }
     }
+    
+    private void prepareJasperClasses() {
+        final String propName = "org.apache.sling.scripting.jsp.jasper.runtime.JspFactoryImpl.USE_POOL";
+        final String propValue = System.getProperty(propName);
+        try {
+            // hacky wacky to prevent PageContext pooling !!!
+            System.setProperty(propName, "false");
+            jspClassLoader.loadClass("org.apache.sling.scripting.jsp.jasper.runtime.JspFactoryImpl");
+        } catch (Throwable t) {
+            // don't care for now
+        } finally {
+            if (propValue != null) {
+                System.setProperty(propName, propValue);
+            }
+        }
+    }
+    
     // ---------- Internal -----------------------------------------------------
 
     private class JspScriptEngine extends AbstractSlingScriptEngine {



Mime
View raw message