geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1387334 - /geronimo/external/trunk/tomcat-parent-7.0.27/jasper/src/main/java/org/apache/jasper/runtime/JspContextWrapper.java
Date Tue, 18 Sep 2012 19:47:57 GMT
Author: gawor
Date: Tue Sep 18 19:47:57 2012
New Revision: 1387334

URL: http://svn.apache.org/viewvc?rev=1387334&view=rev
Log:
Apply optimization for JspContextWrapper: https://issues.apache.org/bugzilla/show_bug.cgi?id=53869

Modified:
    geronimo/external/trunk/tomcat-parent-7.0.27/jasper/src/main/java/org/apache/jasper/runtime/JspContextWrapper.java

Modified: geronimo/external/trunk/tomcat-parent-7.0.27/jasper/src/main/java/org/apache/jasper/runtime/JspContextWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.27/jasper/src/main/java/org/apache/jasper/runtime/JspContextWrapper.java?rev=1387334&r1=1387333&r2=1387334&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.27/jasper/src/main/java/org/apache/jasper/runtime/JspContextWrapper.java
(original)
+++ geronimo/external/trunk/tomcat-parent-7.0.27/jasper/src/main/java/org/apache/jasper/runtime/JspContextWrapper.java
Tue Sep 18 19:47:57 2012
@@ -76,11 +76,24 @@ public class JspContextWrapper extends P
     private Map<String,String> aliases;
 
     private HashMap<String, Object> originalNestedVars;
+    
+    private ServletContext servletContext;
+    
+    private ELContext elContext;
+    
+    private PageContext rootJspCtxt;
 
     public JspContextWrapper(JspContext jspContext,
             ArrayList<String> nestedVars, ArrayList<String> atBeginVars,
             ArrayList<String> atEndVars, Map<String,String> aliases) {
         this.invokingJspCtxt = (PageContext) jspContext;
+        if (jspContext instanceof JspContextWrapper) {
+            rootJspCtxt = ((JspContextWrapper) jspContext).rootJspCtxt;
+        } else {
+            rootJspCtxt = invokingJspCtxt;
+        }
+        this.servletContext = rootJspCtxt.getServletContext();
+        this.elContext = rootJspCtxt.getELContext();
         this.nestedVars = nestedVars;
         this.atBeginVars = atBeginVars;
         this.atEndVars = atEndVars;
@@ -123,7 +136,7 @@ public class JspContextWrapper extends P
             return pageAttributes.get(name);
         }
 
-        return invokingJspCtxt.getAttribute(name, scope);
+        return rootJspCtxt.getAttribute(name, scope);
     }
 
     @Override
@@ -156,7 +169,7 @@ public class JspContextWrapper extends P
                 removeAttribute(name, PAGE_SCOPE);
             }
         } else {
-            invokingJspCtxt.setAttribute(name, value, scope);
+            rootJspCtxt.setAttribute(name, value, scope);
         }
     }
 
@@ -170,13 +183,13 @@ public class JspContextWrapper extends P
 
         Object o = pageAttributes.get(name);
         if (o == null) {
-            o = invokingJspCtxt.getAttribute(name, REQUEST_SCOPE);
+            o = rootJspCtxt.getAttribute(name, REQUEST_SCOPE);
             if (o == null) {
                 if (getSession() != null) {
-                    o = invokingJspCtxt.getAttribute(name, SESSION_SCOPE);
+                    o = rootJspCtxt.getAttribute(name, SESSION_SCOPE);
                 }
                 if (o == null) {
-                    o = invokingJspCtxt.getAttribute(name, APPLICATION_SCOPE);
+                    o = rootJspCtxt.getAttribute(name, APPLICATION_SCOPE);
                 }
             }
         }
@@ -193,11 +206,11 @@ public class JspContextWrapper extends P
         }
 
         pageAttributes.remove(name);
-        invokingJspCtxt.removeAttribute(name, REQUEST_SCOPE);
+        rootJspCtxt.removeAttribute(name, REQUEST_SCOPE);
         if (getSession() != null) {
-            invokingJspCtxt.removeAttribute(name, SESSION_SCOPE);
+            rootJspCtxt.removeAttribute(name, SESSION_SCOPE);
         }
-        invokingJspCtxt.removeAttribute(name, APPLICATION_SCOPE);
+        rootJspCtxt.removeAttribute(name, APPLICATION_SCOPE);
     }
 
     @Override
@@ -211,7 +224,7 @@ public class JspContextWrapper extends P
         if (scope == PAGE_SCOPE) {
             pageAttributes.remove(name);
         } else {
-            invokingJspCtxt.removeAttribute(name, scope);
+            rootJspCtxt.removeAttribute(name, scope);
         }
     }
 
@@ -226,7 +239,7 @@ public class JspContextWrapper extends P
         if (pageAttributes.get(name) != null) {
             return PAGE_SCOPE;
         } else {
-            return invokingJspCtxt.getAttributesScope(name);
+            return rootJspCtxt.getAttributesScope(name);
         }
     }
 
@@ -236,7 +249,7 @@ public class JspContextWrapper extends P
             return Collections.enumeration(pageAttributes.keySet());
         }
 
-        return invokingJspCtxt.getAttributeNamesInScope(scope);
+        return rootJspCtxt.getAttributeNamesInScope(scope);
     }
 
     @Override
@@ -246,12 +259,12 @@ public class JspContextWrapper extends P
 
     @Override
     public JspWriter getOut() {
-        return invokingJspCtxt.getOut();
+        return rootJspCtxt.getOut();
     }
 
     @Override
     public HttpSession getSession() {
-        return invokingJspCtxt.getSession();
+        return rootJspCtxt.getSession();
     }
 
     @Override
@@ -266,7 +279,7 @@ public class JspContextWrapper extends P
 
     @Override
     public ServletResponse getResponse() {
-        return invokingJspCtxt.getResponse();
+        return rootJspCtxt.getResponse();
     }
 
     @Override
@@ -281,7 +294,7 @@ public class JspContextWrapper extends P
 
     @Override
     public ServletContext getServletContext() {
-        return invokingJspCtxt.getServletContext();
+        return servletContext;
     }
 
     @Override
@@ -481,7 +494,7 @@ public class JspContextWrapper extends P
     public ELContext getELContext() {
         // instead decorate!!!
         
-        return this.invokingJspCtxt.getELContext();
+        return elContext;
         
         /*
         if (this.elContext != null) {



Mime
View raw message