struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From musa...@apache.org
Subject svn commit: r722576 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
Date Tue, 02 Dec 2008 19:13:27 GMT
Author: musachy
Date: Tue Dec  2 11:13:26 2008
New Revision: 722576

URL: http://svn.apache.org/viewvc?rev=722576&view=rev
Log:
WW-2902 Use real HttpSession in synchronized block

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java?rev=722576&r1=722575&r2=722576&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/TokenInterceptor.java
Tue Dec  2 11:13:26 2008
@@ -24,6 +24,7 @@
 import java.util.Map;
 
 import org.apache.struts2.util.TokenHelper;
+import org.apache.struts2.ServletActionContext;
 
 import com.opensymphony.xwork2.ActionContext;
 import com.opensymphony.xwork2.ActionInvocation;
@@ -31,6 +32,8 @@
 import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
 import com.opensymphony.xwork2.util.LocalizedTextUtil;
 
+import javax.servlet.http.HttpSession;
+
 /**
  * <!-- START SNIPPET: description -->
  *
@@ -129,7 +132,9 @@
             log.debug("Intercepting invocation to check for valid transaction token.");
         }
 
-        Map session = ActionContext.getContext().getSession();
+        //see WW-2902: we need to use the real HttpSession here, as opposed to the map
+        //that wraps the session, because a new wrap is created on every request
+        HttpSession session = ServletActionContext.getRequest().getSession(true);
 
         synchronized (session) {
             if (!TokenHelper.validToken()) {



Mime
View raw message