]
Norman Richards commented on JBSEAM-2023:
-----------------------------------------
Dan - this change is good to go in.
short-circuit page actions on first navigation event
----------------------------------------------------
Key: JBSEAM-2023
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2023
Project: JBoss Seam
Issue Type: Feature Request
Components: Core
Affects Versions: 2.0.0.CR1
Reporter: Dan Allen
Assigned To: Dan Allen
Priority: Minor
Fix For: 2.0.0.CR2
Attachments: JBSEAM-2023-v1.txt, PageActionsTest.java, pages.xml
Original Estimate: 2 hours
Remaining Estimate: 2 hours
Page actions currently have one severe quirk. If multiple page actions are configured for
a view-id pattern, they all execute without checking whether or not a navigation has
occurred (a navigation match was found). What is even more strange is that even when a
navigation match is found and the JSF NavigationHandler has processed the navigation, the
actions just keep on executing. I cannot imagine that invoking the navigation handler
multiple times was anticipated behavior. Even if it is, the developer is still going to be
massively confused which navigation event is going to actually stick.
Here is the current logic:
for ( Action action: getActions() )
{
if ( action.isExecutable() )
{
String outcome = action.getOutcome();
String fromAction = outcome;
if (outcome==null)
{
fromAction = action.getMethodExpression().getExpressionString();
result = true;
outcome = Pages.toString( action.getMethodExpression().invoke() );
Pages.handleOutcome(facesContext, outcome, fromAction);
}
else
{
Pages.handleOutcome(facesContext, outcome, fromAction);
}
}
}
I think that the short-circuit that needs to take place is that if the response is marked
as complete (which indicates a redirect navigation) or if the UIViewRoot changed (which
indicates a non-redirect navigation), then the actions should stop executing.
We should definitely include a test case if we make this change. Its too important to
screw up.
If there is a desire to maintain the previous behavior, then I believe a flag should be
added on the page element like so
<page short-circuit-actions="false">
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: