Commits

Anonymous committed 481a0f8

Performance optimizations for ActionContext access
Issue number: WW-1365
Submitted by: Philip Luppens
Reviewed by: Tom Schneider

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@2822573baa09-0c28-0410-bef9-dab3c582ae83

Comments (0)

Files changed (1)

src/java/com/opensymphony/webwork/dispatcher/WebWorkRequestWrapper.java

         Object attribute = super.getAttribute(s);
 
         boolean alreadyIn = false;
-        Boolean b = (Boolean) ActionContext.getContext().get("__requestWrapper.getAttribute");
+        //WW-1365
+        ActionContext ctx = ActionContext.getContext();
+        Boolean b = (Boolean) ctx.get("__requestWrapper.getAttribute");
         if (b != null) {
             alreadyIn = b.booleanValue();
         }
         if (!alreadyIn && attribute == null && s.indexOf("#") == -1) {
             try {
                 // If not found, then try the ValueStack
-                ActionContext.getContext().put("__requestWrapper.getAttribute", Boolean.TRUE);
-                OgnlValueStack stack = ActionContext.getContext().getValueStack();
+                ctx.put("__requestWrapper.getAttribute", Boolean.TRUE);
+                OgnlValueStack stack = ctx.getValueStack();
                 if (stack != null) {
                     attribute = stack.findValue(s);
                 }
             } finally {
-                ActionContext.getContext().put("__requestWrapper.getAttribute", Boolean.FALSE);
+                ctx.put("__requestWrapper.getAttribute", Boolean.FALSE);
             }
         }
         return attribute;