SWF-964 & SWF-839 - UI component state not being saved correctly across the redirect on recursive transitions

This commit is contained in:
Jeremy Grelle
2008-12-09 19:21:20 +00:00
parent a7180df01d
commit 9b52a47d84
4 changed files with 15 additions and 14 deletions

View File

@@ -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)) {

View File

@@ -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();
}

View File

@@ -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() {

View File

@@ -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);