incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1154977 - in /sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper: compiler/JspRuntimeContext.java runtime/ExternalServletContextWrapper.java
Date Mon, 08 Aug 2011 14:52:02 GMT
Author: justin
Date: Mon Aug  8 14:52:02 2011
New Revision: 1154977

URL: http://svn.apache.org/viewvc?rev=1154977&view=rev
Log:
SLING-2169 - reimplementing c:import support by resetting the USE_OWN_FACTORY usage counter
to 0 before an include/forward and then restoring the value after the include/forward

Modified:
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java
    sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ExternalServletContextWrapper.java

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java?rev=1154977&r1=1154976&r2=1154977&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java
(original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/compiler/JspRuntimeContext.java
Mon Aug  8 14:52:02 2011
@@ -150,8 +150,14 @@ public final class JspRuntimeContext {
             JspRuntimeContext.USE_OWN_FACTORY.set(count - 1);
         }
 
-        public JspFactory getOriginal() {
-            return original;
+        public int resetUsage() {
+            final Integer count = JspRuntimeContext.USE_OWN_FACTORY.get();
+            JspRuntimeContext.USE_OWN_FACTORY.set(0);
+            return count;
+        }
+
+        public void setUsage(int count) {
+            JspRuntimeContext.USE_OWN_FACTORY.set(count);
         }
     }
 

Modified: sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ExternalServletContextWrapper.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ExternalServletContextWrapper.java?rev=1154977&r1=1154976&r2=1154977&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ExternalServletContextWrapper.java
(original)
+++ sling/trunk/bundles/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/jasper/runtime/ExternalServletContextWrapper.java
Mon Aug  8 14:52:02 2011
@@ -158,28 +158,28 @@ class ExternalServletContextWrapper impl
 
         public void forward(ServletRequest request, ServletResponse response) throws ServletException,
                 IOException {
-            JspFactory saveDefaultFactory = JspFactory.getDefaultFactory();
-            if (saveDefaultFactory instanceof JspFactoryHandler) {
+            JspFactory jspFactory = JspFactory.getDefaultFactory();
+            if (jspFactory instanceof JspFactoryHandler) {
                 pageContext.getOut().flush();
-                JspFactory.setDefaultFactory(((JspFactoryHandler)saveDefaultFactory).getOriginal());
+                final int count = ((JspFactoryHandler)jspFactory).resetUsage();
                 try {
                     delegate.forward(request, response);
                 } finally {
-                    JspFactory.setDefaultFactory(saveDefaultFactory);
+                    ((JspFactoryHandler)jspFactory).setUsage(count);
                 }
             }
         }
 
         public void include(ServletRequest request, ServletResponse response) throws ServletException,
                 IOException {
-            JspFactory saveDefaultFactory = JspFactory.getDefaultFactory();
-            if (saveDefaultFactory instanceof JspFactoryHandler) {
+            JspFactory jspFactory = JspFactory.getDefaultFactory();
+            if (jspFactory instanceof JspFactoryHandler) {
                 pageContext.getOut().flush();
-                JspFactory.setDefaultFactory(((JspFactoryHandler)saveDefaultFactory).getOriginal());
+                final int count = ((JspFactoryHandler)jspFactory).resetUsage();
                 try {
                     delegate.include(request, response);
                 } finally {
-                    JspFactory.setDefaultFactory(saveDefaultFactory);
+                    ((JspFactoryHandler)jspFactory).setUsage(count);
                 }
             }
 



Mime
View raw message