You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2011/03/26 16:34:47 UTC
svn commit: r1085737 - in /myfaces/core/branches/2.1.x:
api/src/main/java/javax/faces/application/StateManager.java
impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java
Author: lu4242
Date: Sat Mar 26 15:34:47 2011
New Revision: 1085737
URL: http://svn.apache.org/viewvc?rev=1085737&view=rev
Log:
MYFACES-3083 Implement StateManager.IS_SAVING_STATE
Modified:
myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/application/StateManager.java
myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java
Modified: myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/application/StateManager.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/application/StateManager.java?rev=1085737&r1=1085736&r2=1085737&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/application/StateManager.java (original)
+++ myfaces/core/branches/2.1.x/api/src/main/java/javax/faces/application/StateManager.java Sat Mar 26 15:34:47 2011
@@ -90,6 +90,8 @@ public abstract class StateManager
public static final String IS_BUILDING_INITIAL_STATE = "javax.faces.IS_BUILDING_INITIAL_STATE";
+ public static final String IS_SAVING_STATE = "javax.faces.IS_SAVING_STATE";
+
/**
* Invokes getTreeStructureToSave and getComponentStateToSave, then return an object that wraps the two resulting
* objects. This object can then be passed to method writeState.
Modified: myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java?rev=1085737&r1=1085736&r2=1085737&view=diff
==============================================================================
--- myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java (original)
+++ myfaces/core/branches/2.1.x/impl/src/main/java/org/apache/myfaces/application/jsp/JspStateManagerImpl.java Sat Mar 26 15:34:47 2011
@@ -54,6 +54,7 @@ import org.apache.myfaces.shared_impl.re
import org.apache.myfaces.shared_impl.util.MyFacesObjectInputStream;
import javax.faces.FactoryFinder;
+import javax.faces.application.StateManager;
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
@@ -436,28 +437,36 @@ public class JspStateManagerImpl extends
String viewId = uiViewRoot.getViewId();
ViewDeclarationLanguage vdl = facesContext.getApplication().
getViewHandler().getViewDeclarationLanguage(facesContext,viewId);
- if (vdl != null)
+ try
{
- StateManagementStrategy sms = vdl.getStateManagementStrategy(facesContext, viewId);
-
- if (sms != null)
+ facesContext.getAttributes().put(StateManager.IS_SAVING_STATE, Boolean.TRUE);
+ if (vdl != null)
{
- if (log.isLoggable(Level.FINEST)) log.finest("Calling saveView of StateManagementStrategy: "+sms.getClass().getName());
+ StateManagementStrategy sms = vdl.getStateManagementStrategy(facesContext, viewId);
- return sms.saveView(facesContext);
+ if (sms != null)
+ {
+ if (log.isLoggable(Level.FINEST)) log.finest("Calling saveView of StateManagementStrategy: "+sms.getClass().getName());
+
+ return sms.saveView(facesContext);
+ }
+ }
+
+ // In StateManagementStrategy.saveView there is a check for transient at
+ // start, but the same applies for VDL without StateManagementStrategy,
+ // so this should be checked before call parent (note that parent method
+ // does not do this check).
+ if (uiViewRoot.isTransient())
+ {
+ return null;
}
+
+ return super.saveView(facesContext);
}
-
- // In StateManagementStrategy.saveView there is a check for transient at
- // start, but the same applies for VDL without StateManagementStrategy,
- // so this should be checked before call parent (note that parent method
- // does not do this check).
- if (uiViewRoot.isTransient())
+ finally
{
- return null;
+ facesContext.getAttributes().remove(StateManager.IS_SAVING_STATE);
}
-
- return super.saveView(facesContext);
}
@Override