diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/FlowViewHandler.java b/spring-faces/src/main/java/org/springframework/faces/webflow/FlowViewHandler.java index 08266db2..e2b5e522 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/FlowViewHandler.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/FlowViewHandler.java @@ -71,9 +71,7 @@ public class FlowViewHandler extends ViewHandler { String resourcePath = viewId; if (JsfUtils.isFlowRequest()) { resourcePath = resolveResourcePath(RequestContextHolder.getRequestContext(), viewId); - if (JsfUtils.isPortlet(context)) { - return restoreFlowPortletView(context, resourcePath); - } + return restoreFlowView(context, resourcePath); } return delegate.restoreView(context, resourcePath); } @@ -120,7 +118,7 @@ public class FlowViewHandler extends ViewHandler { } } - private UIViewRoot restoreFlowPortletView(FacesContext facesContext, String resourcePath) { + private UIViewRoot restoreFlowView(FacesContext facesContext, String resourcePath) { RequestContext context = RequestContextHolder.getRequestContext(); ViewRootHolder holder = (ViewRootHolder) context.getFlashScope().get(ViewRootHolder.VIEW_ROOT_HOLDER_KEY); if (holder != null && holder.getViewRoot().getViewId().equals(resourcePath)) { diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfView.java b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfView.java index 547174a7..0543d037 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/JsfView.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/JsfView.java @@ -111,10 +111,7 @@ public class JsfView implements View { if (restored && !facesContext.getRenderResponse() && !facesContext.getResponseComplete()) { facesLifecycle.execute(facesContext); } - if (JsfUtils.isPortlet(facesContext)) { - requestContext.getFlashScope().put(ViewRootHolder.VIEW_ROOT_HOLDER_KEY, - new ViewRootHolder(getViewRoot())); - } + requestContext.getFlashScope().put(ViewRootHolder.VIEW_ROOT_HOLDER_KEY, new ViewRootHolder(getViewRoot())); } finally { facesContext.release(); } diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java index 166929a2..2eb5bd90 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewFactoryTests.java @@ -116,7 +116,7 @@ public class JsfViewFactoryTests extends TestCase { } /** - * View already exists in flash scope and must be restored and the lifecycle executed, no event signaled + * View already exists in view/flash scope and must be restored and the lifecycle executed, no event signaled */ public final void testGetView_Restore() { @@ -147,7 +147,7 @@ public class JsfViewFactoryTests extends TestCase { } /** - * View already exists in flash scope and must be restored and the lifecycle executed, no event signaled + * View already exists in view/flash scope and must be restored and the lifecycle executed, no event signaled */ public final void testGetView_RestoreWithBindings() { @@ -192,7 +192,7 @@ public class JsfViewFactoryTests extends TestCase { } /** - * Ajax Request - View already exists in flash scope and must be restored and the lifecycle executed, no event + * Ajax Request - View already exists in view/flash scope and must be restored and the lifecycle executed, no event * signaled */ public final void testGetView_Restore_Ajax() { diff --git a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewTests.java b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewTests.java index d68d5aa5..bb28c63e 100644 --- a/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewTests.java +++ b/spring-faces/src/test/java/org/springframework/faces/webflow/JsfViewTests.java @@ -128,7 +128,7 @@ public class JsfViewTests extends TestCase { } /** - * View already exists in flash scope and must be restored and the lifecycle executed, no event signaled + * View already exists in view scope and must be restored and the lifecycle executed, no event signaled */ public final void testResume_Restored_NoEvent() { @@ -136,6 +136,8 @@ public class JsfViewTests extends TestCase { Boolean.FALSE); EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn( Boolean.FALSE); + EasyMock.expect(flashScope.put(EasyMock.matches(ViewRootHolder.VIEW_ROOT_HOLDER_KEY), EasyMock.anyObject())) + .andStubReturn(null); EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject())) .andStubReturn(null); @@ -156,7 +158,7 @@ public class JsfViewTests extends TestCase { } /** - * Ajax Request - View already exists in flash scope and must be restored and the lifecycle executed, no event + * Ajax Request - View already exists in view scope and must be restored and the lifecycle executed, no event * signaled */ public final void testGetView_Restore_Ajax_NoEvent() { @@ -165,6 +167,8 @@ public class JsfViewTests extends TestCase { Boolean.FALSE); EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn( Boolean.FALSE); + EasyMock.expect(flashScope.put(EasyMock.matches(ViewRootHolder.VIEW_ROOT_HOLDER_KEY), EasyMock.anyObject())) + .andStubReturn(null); EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject())) .andStubReturn(null); @@ -186,7 +190,7 @@ public class JsfViewTests extends TestCase { } /** - * View already exists in flowscope and must be restored and the lifecycle executed, an event is signaled + * View already exists in view scope and must be restored and the lifecycle executed, an event is signaled */ public final void testGetView_Restore_EventSignaled() { @@ -194,6 +198,8 @@ public class JsfViewTests extends TestCase { Boolean.FALSE); EasyMock.expect(flashScope.getBoolean(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY))).andStubReturn( Boolean.FALSE); + EasyMock.expect(flashScope.put(EasyMock.matches(ViewRootHolder.VIEW_ROOT_HOLDER_KEY), EasyMock.anyObject())) + .andStubReturn(null); EasyMock.expect(flashScope.put(EasyMock.matches(FlowFacesContext.RENDER_RESPONSE_KEY), EasyMock.anyObject())) .andStubReturn(null);