render from end-state bug fix for mvc and jsf
This commit is contained in:
@@ -85,10 +85,6 @@ public class FlowViewStateManager extends StateManager {
|
||||
return super.restoreTreeStructure(context, viewId, renderKitId);
|
||||
}
|
||||
RequestContext requestContext = RequestContextHolder.getRequestContext();
|
||||
if (!requestContext.inViewState()) {
|
||||
logger.debug("Not in a view state; no state to restore");
|
||||
return null;
|
||||
}
|
||||
SerializedView view = (SerializedView) requestContext.getViewScope().get(SERIALIZED_VIEW_STATE);
|
||||
if (view == null || !view.viewId.equals(viewId)) {
|
||||
logger.debug("No matching view in view scope");
|
||||
|
||||
@@ -93,15 +93,24 @@ public class JsfViewFactory implements ViewFactory {
|
||||
view = createJsfView(facesContext.getViewRoot(), lifecycle, context);
|
||||
view.setRestored(true);
|
||||
} else {
|
||||
UIViewRoot viewRoot = viewHandler.restoreView(facesContext, viewName);
|
||||
if (viewRoot != null) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("View root restored for '" + viewName + "'");
|
||||
if (context.inViewState()) {
|
||||
UIViewRoot viewRoot = viewHandler.restoreView(facesContext, viewName);
|
||||
if (viewRoot != null) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("View root restored for '" + viewName + "'");
|
||||
}
|
||||
view = createJsfView(viewRoot, lifecycle, context);
|
||||
facesContext.setViewRoot(view.getViewRoot());
|
||||
processTree(facesContext, view.getViewRoot());
|
||||
view.setRestored(true);
|
||||
} else {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating view root for '" + viewName + "'");
|
||||
}
|
||||
view = createJsfView(viewHandler.createView(facesContext, viewName), lifecycle, context);
|
||||
facesContext.setViewRoot(view.getViewRoot());
|
||||
view.setRestored(false);
|
||||
}
|
||||
view = createJsfView(viewRoot, lifecycle, context);
|
||||
facesContext.setViewRoot(view.getViewRoot());
|
||||
processTree(facesContext, view.getViewRoot());
|
||||
view.setRestored(true);
|
||||
} else {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating view root for '" + viewName + "'");
|
||||
|
||||
@@ -86,6 +86,8 @@ public class JsfFinalResponseActionTests extends TestCase {
|
||||
newRoot.setViewId(VIEW_ID);
|
||||
newRoot.setRenderKitId("HTML_BASIC");
|
||||
((MockViewHandler) viewHandler).setCreateView(newRoot);
|
||||
context.inViewState();
|
||||
EasyMock.expectLastCall().andReturn(Boolean.FALSE);
|
||||
|
||||
EasyMock.replay(new Object[] { context });
|
||||
|
||||
|
||||
@@ -102,6 +102,8 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
UIViewRoot newRoot = new UIViewRoot();
|
||||
newRoot.setViewId(VIEW_ID);
|
||||
((MockViewHandler) viewHandler).setCreateView(newRoot);
|
||||
context.inViewState();
|
||||
EasyMock.expectLastCall().andReturn(Boolean.TRUE);
|
||||
|
||||
EasyMock.replay(new Object[] { context });
|
||||
|
||||
@@ -130,6 +132,9 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
existingRoot.getChildren().add(input);
|
||||
((MockViewHandler) viewHandler).setRestoreView(existingRoot);
|
||||
|
||||
context.inViewState();
|
||||
EasyMock.expectLastCall().andReturn(Boolean.TRUE);
|
||||
|
||||
EasyMock.replay(new Object[] { context });
|
||||
|
||||
View restoredView = factory.getView(context);
|
||||
@@ -171,6 +176,9 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
|
||||
((MockViewHandler) viewHandler).setRestoreView(existingRoot);
|
||||
|
||||
context.inViewState();
|
||||
EasyMock.expectLastCall().andReturn(Boolean.TRUE);
|
||||
|
||||
EasyMock.replay(new Object[] { context });
|
||||
|
||||
View restoredView = factory.getView(context);
|
||||
@@ -201,6 +209,9 @@ public class JsfViewFactoryTests extends TestCase {
|
||||
|
||||
EasyMock.expect(context.getCurrentState()).andReturn(new NormalViewState());
|
||||
|
||||
context.inViewState();
|
||||
EasyMock.expectLastCall().andReturn(Boolean.TRUE);
|
||||
|
||||
EasyMock.replay(new Object[] { context });
|
||||
|
||||
View restoredView = factory.getView(context);
|
||||
|
||||
Reference in New Issue
Block a user