myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1197473 - /myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/JsfRestParameters.java
Date Fri, 04 Nov 2011 10:00:59 GMT
Author: struberg
Date: Fri Nov  4 10:00:59 2011
New Revision: 1197473

URL: http://svn.apache.org/viewvc?rev=1197473&view=rev
Log:
EXTCDI-232 only set viewParams on AfterRenderResponse for GET requests

Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/JsfRestParameters.java

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/JsfRestParameters.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/JsfRestParameters.java?rev=1197473&r1=1197472&r2=1197473&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/JsfRestParameters.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/scope/conversation/JsfRestParameters.java
Fri Nov  4 10:00:59 2011
@@ -30,11 +30,15 @@ import javax.faces.event.PhaseEvent;
 import javax.faces.view.ViewMetadata;
 import java.io.Serializable;
 import java.util.Collection;
-import java.util.HashMap;
+import java.util.Map;
 import java.util.TreeSet;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * This class holds information about the last used RestParameters for a given JSF view.
+ *
+ * It will expire the conversation when any of those Views get accessed via GET with
+ * a different set of <f:viewParam>s.
  */
 @WindowScoped
 public class JsfRestParameters extends RestParameters implements Serializable
@@ -54,7 +58,7 @@ public class JsfRestParameters extends R
      *
      * TODO we might change this to only store a hashKey.
      */
-    private HashMap<String, String> viewParametersForViewId = new HashMap<String,
String>();
+    private Map<String, String> viewParametersForViewId = new ConcurrentHashMap<String,
String>();
 
     /**
      * Check and update the view parameters of the given viewId.
@@ -131,7 +135,6 @@ public class JsfRestParameters extends R
                 viewParamValue = "";
             }
 
-            //X TODO it might be necessary to sort this first according to the viewParamNames.
             sb.append(viewParamName).append("=").append(viewParamValue).append("+/+");
         }
 
@@ -158,7 +161,14 @@ public class JsfRestParameters extends R
             return;
         }
 
-        FacesContext facesContext = FacesContext.getCurrentInstance();
+        FacesContext facesContext = phaseEvent.getFacesContext();
+
+        // we ignore postbacks
+        if (facesContext.isPostback())
+        {
+            return;
+        }
+
         String viewId = facesContext.getViewRoot().getViewId();
         viewParametersForViewId.put(viewId, getViewParams(facesContext, viewId));
     }



Mime
View raw message