userEventQueued; in progress, get method should not have side effects
This commit is contained in:
@@ -47,8 +47,6 @@ public class JsfView implements View {
|
||||
|
||||
private String viewId;
|
||||
|
||||
private boolean restored;
|
||||
|
||||
/**
|
||||
* Creates a new JSF view.
|
||||
* @param viewRoot the view root
|
||||
@@ -74,14 +72,6 @@ public class JsfView implements View {
|
||||
this.viewRoot = viewRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether or not the view root for this view was restored from storage or is new.
|
||||
* @param restored true or false
|
||||
*/
|
||||
public void setRestored(boolean restored) {
|
||||
this.restored = restored;
|
||||
}
|
||||
|
||||
/*
|
||||
* Performs the standard duties of the JSF RENDER_RESPONSE phase.
|
||||
*/
|
||||
@@ -103,6 +93,10 @@ public class JsfView implements View {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean userEventQueued() {
|
||||
return requestContext.getRequestParameters().size() > 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Executes postback-processing portions of the standard JSF lifecycle including APPLY_REQUEST_VALUES through
|
||||
* INVOKE_APPLICATION.
|
||||
@@ -111,10 +105,11 @@ public class JsfView implements View {
|
||||
FacesContext facesContext = FlowFacesContext.newInstance(requestContext, facesLifecycle);
|
||||
facesContext.setViewRoot(viewRoot);
|
||||
try {
|
||||
if (restored && !facesContext.getRenderResponse() && !facesContext.getResponseComplete()) {
|
||||
facesLifecycle.execute(facesContext);
|
||||
facesLifecycle.execute(facesContext);
|
||||
if (!hasFlowEvent()) {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -88,7 +88,6 @@ public class JsfViewFactory implements ViewFactory {
|
||||
viewRoot.setLocale(context.getExternalContext().getLocale());
|
||||
processTree(facesContext, viewRoot);
|
||||
view = createJsfView(facesContext.getViewRoot(), lifecycle, context);
|
||||
view.setRestored(true);
|
||||
} else {
|
||||
if (context.inViewState()) {
|
||||
UIViewRoot viewRoot = viewHandler.restoreView(facesContext, viewName);
|
||||
@@ -99,7 +98,6 @@ public class JsfViewFactory implements ViewFactory {
|
||||
facesContext.setViewRoot(viewRoot);
|
||||
processTree(facesContext, viewRoot);
|
||||
view = createJsfView(viewRoot, lifecycle, context);
|
||||
view.setRestored(true);
|
||||
} else {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Creating UIViewRoot from '" + viewName + "'");
|
||||
@@ -107,7 +105,6 @@ public class JsfViewFactory implements ViewFactory {
|
||||
viewRoot = viewHandler.createView(facesContext, viewName);
|
||||
facesContext.setViewRoot(viewRoot);
|
||||
view = createJsfView(viewRoot, lifecycle, context);
|
||||
view.setRestored(false);
|
||||
}
|
||||
} else {
|
||||
if (logger.isDebugEnabled()) {
|
||||
@@ -117,7 +114,6 @@ public class JsfViewFactory implements ViewFactory {
|
||||
viewRoot.setTransient(true);
|
||||
facesContext.setViewRoot(viewRoot);
|
||||
view = createJsfView(viewRoot, lifecycle, context);
|
||||
view.setRestored(false);
|
||||
}
|
||||
}
|
||||
if (!facesContext.getRenderResponse()) {
|
||||
|
||||
@@ -143,7 +143,6 @@ public class JsfViewTests extends TestCase {
|
||||
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, flashScope });
|
||||
|
||||
JsfView restoredView = new JsfView(existingRoot, lifecycle, context);
|
||||
restoredView.setRestored(true);
|
||||
|
||||
restoredView.processUserEvent();
|
||||
|
||||
@@ -173,7 +172,6 @@ public class JsfViewTests extends TestCase {
|
||||
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, flashScope });
|
||||
|
||||
JsfView restoredView = new JsfView(ajaxRoot, lifecycle, context);
|
||||
restoredView.setRestored(true);
|
||||
|
||||
restoredView.processUserEvent();
|
||||
|
||||
@@ -201,7 +199,6 @@ public class JsfViewTests extends TestCase {
|
||||
EasyMock.replay(new Object[] { context, flowExecutionContext, flowMap, flashScope });
|
||||
|
||||
JsfView restoredView = new JsfView(existingRoot, lifecycle, context);
|
||||
restoredView.setRestored(true);
|
||||
|
||||
restoredView.processUserEvent();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user