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 55399b19..e93637f1 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 @@ -122,7 +122,7 @@ public class FlowViewHandler extends ViewHandler { private UIViewRoot restoreFlowView(FacesContext facesContext, String resourcePath) { RequestContext context = RequestContextHolder.getRequestContext(); ViewRootHolder holder = (ViewRootHolder) context.getFlashScope().get(View.USER_EVENT_STATE_ATTRIBUTE); - if (holder != null && holder.getViewRoot().getViewId().equals(resourcePath)) { + if (holder != null && holder.getViewRoot() != null && holder.getViewRoot().getViewId().equals(resourcePath)) { return holder.getViewRoot(); } else { return delegate.restoreView(facesContext, 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 8eaf7fe0..2c2d13f5 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 @@ -16,6 +16,7 @@ package org.springframework.faces.webflow; import java.io.IOException; +import java.io.Serializable; import javax.faces.component.UIViewRoot; import javax.faces.context.FacesContext; @@ -133,7 +134,7 @@ public class JsfView implements View { } } - public Object getUserEventState() { + public Serializable getUserEventState() { // Set the temporary UIViewRoot state so that it will be available across the redirect return new ViewRootHolder(getViewRoot()); } diff --git a/spring-faces/src/main/java/org/springframework/faces/webflow/ViewRootHolder.java b/spring-faces/src/main/java/org/springframework/faces/webflow/ViewRootHolder.java index 14a51555..77091fde 100644 --- a/spring-faces/src/main/java/org/springframework/faces/webflow/ViewRootHolder.java +++ b/spring-faces/src/main/java/org/springframework/faces/webflow/ViewRootHolder.java @@ -15,6 +15,8 @@ */ package org.springframework.faces.webflow; +import java.io.Serializable; + import javax.faces.component.UIViewRoot; /** @@ -22,9 +24,9 @@ import javax.faces.component.UIViewRoot; * * @author Scott Andrews */ -class ViewRootHolder { +class ViewRootHolder implements Serializable { - private UIViewRoot viewRoot; + private transient UIViewRoot viewRoot; public ViewRootHolder(UIViewRoot viewRoot) { this.viewRoot = viewRoot;