From 5f00880992bac80a1a73fbf558eb00db9a2000c8 Mon Sep 17 00:00:00 2001 From: "Donald J. Brown" Date: Mon, 9 Oct 2006 20:49:26 +0000 Subject: [PATCH] Slightly optimize servlet request wrapper WW-1453 git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@454501 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/struts2/dispatcher/StrutsRequestWrapper.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/apache/struts2/dispatcher/StrutsRequestWrapper.java b/core/src/main/java/org/apache/struts2/dispatcher/StrutsRequestWrapper.java index 1f1a0359c..7d002afdc 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/StrutsRequestWrapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/StrutsRequestWrapper.java @@ -57,10 +57,11 @@ public class StrutsRequestWrapper extends HttpServletRequestWrapper { return super.getAttribute(s); } + ActionContext ctx = ActionContext.getContext(); Object attribute = super.getAttribute(s); boolean alreadyIn = false; - Boolean b = (Boolean) ActionContext.getContext().get("__requestWrapper.getAttribute"); + Boolean b = (Boolean) ctx.get("__requestWrapper.getAttribute"); if (b != null) { alreadyIn = b.booleanValue(); } @@ -70,13 +71,13 @@ public class StrutsRequestWrapper extends HttpServletRequestWrapper { if (!alreadyIn && attribute == null && s.indexOf("#") == -1) { try { // If not found, then try the ValueStack - ActionContext.getContext().put("__requestWrapper.getAttribute", Boolean.TRUE); - ValueStack stack = ActionContext.getContext().getValueStack(); + ctx.put("__requestWrapper.getAttribute", Boolean.TRUE); + ValueStack 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;