Move state saving to getUserEventState()

Update JsfView so that state saving no longer occurs during
processUserEvent(). This is required to ensure that Mojarra's
StateContext.release(...) method is not called too early.

Prior to Mojarra 2.1.16 multiple calls to saveView had no side effects,
but the fix to JAVASERVERFACES-2609 changed this behavior.

In order to retain the fix for SWF-1577 the saveState() method is now
called from getUserEventState(). This should ensure that the
StateContext$AddRemoveListerner is still removed, even when WebFlow
bypasses the usual state saving for certain flow redirects.

Issue: SWF-1631
This commit is contained in:
Rossen Stoyanchev
2014-05-22 14:23:05 -04:00
parent 840a41464d
commit 0636499121
2 changed files with 6 additions and 9 deletions

View File

@@ -1 +1 @@
version=2.3.3.BUILD-SNAPSHOT
version=2.3.4.BUILD-SNAPSHOT

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2004-2013 the original author or authors.
* Copyright 2004-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -87,13 +87,6 @@ public class JsfView implements View {
try {
logger.debug("Asking faces lifecycle to render");
facesLifecycle.render(facesContext);
/* Ensure serialized view state is always updated even if JSF didn't call StateManager.writeState(). */
if (JsfRuntimeInformation.isAtLeastJsf20()) {
if (requestContext.getExternalContext().isAjaxRequest()) {
saveState();
}
}
} finally {
logger.debug("View rendering complete");
facesContext.responseComplete();
@@ -141,6 +134,10 @@ public class JsfView implements View {
public Serializable getUserEventState() {
// Set the temporary UIViewRoot state so that it will be available across the redirect
// Ensure serialized view state is always updated even if JSF didn't call StateManager.writeState(). SWF-1577
saveState();
return new ViewRootHolder(getViewRoot());
}