SWF-964 & SWF-839 - UI component state not being saved correctly across the redirect on recursive transitions
This commit is contained in:
@@ -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)) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user