You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2011/07/14 21:29:50 UTC

svn commit: r1146866 - /myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java

Author: gcrawford
Date: Thu Jul 14 19:29:50 2011
New Revision: 1146866

URL: http://svn.apache.org/viewvc?rev=1146866&view=rev
Log:
TRINIDAD-2114 statemanagerimpl not setting is_saving_state

Modified:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java?rev=1146866&r1=1146865&r2=1146866&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/application/StateManagerImpl.java Thu Jul 14 19:29:50 2011
@@ -171,28 +171,42 @@ public class StateManagerImpl extends St
 
     String viewId = viewRoot.getViewId();
     StateManagementStrategy sms = _getStateManagementStrategy(context, viewId);
-
-    if (sms != null)
-    {
-      // Force view root to use full state saving
-      // This is necessary because we recreate the view root on postback when view root caching
-      // is enabled and assume that that we can apply the full state
-      if (_useViewRootCache(context))
-      {
-        viewRoot.clearInitialState();
-      }
-      
-      viewState = sms.saveView(context);
-    }
-    else
-    {
-      // if there's no stateManagementStrategy handle saving the state ourselves
-      _removeTransientComponents(viewRoot);
-
-      Object structure = !_needStructure(context) ? null : new Structure(viewRoot);
-      Object state = viewRoot.processSaveState(context);
-      viewState = new Object[]{structure, state};
-
+    Map<Object, Object> contextAttributes = context.getAttributes();
+    
+    try
+    {
+        // TODO Once we're dependent on JSF 2.1 we should be using StateManager.IS_SAVING_STATE as the key, but 
+        // for now we can use the String value of StateManager.IS_SAVING_STATE
+        contextAttributes.put("javax.faces.IS_SAVING_STATE", Boolean.TRUE);
+        
+        if (sms != null)
+        {
+          // Force view root to use full state saving
+          // This is necessary because we recreate the view root on postback when view root caching
+          // is enabled and assume that that we can apply the full state
+          if (_useViewRootCache(context))
+          {
+            viewRoot.clearInitialState();
+          }
+          
+          viewState = sms.saveView(context);
+        }
+        else
+        {
+          // if there's no stateManagementStrategy handle saving the state ourselves
+          _removeTransientComponents(viewRoot);
+    
+          Object structure = !_needStructure(context) ? null : new Structure(viewRoot);
+          Object state = viewRoot.processSaveState(context);
+          viewState = new Object[]{structure, state};
+    
+        }        
+    }
+    finally 
+    {
+      // TODO Once we're dependent on JSF 2.1 we should be using StateManager.IS_SAVING_STATE as the key, but 
+      // for now we can use the String value of StateManager.IS_SAVING_STATE
+      contextAttributes.remove("javax.faces.IS_SAVING_STATE");
     }
 
     if (_saveAsToken(context))