This commit is contained in:
Keith Donald
2009-03-10 04:24:56 +00:00
parent db62fedbcd
commit 2b224c68cd
2 changed files with 25 additions and 2 deletions

View File

@@ -190,13 +190,16 @@ public class ViewState extends TransitionableState {
if (logger.isDebugEnabled()) {
logger.debug("Event '" + event.getId() + "' returned from view " + view);
}
context.getRequestScope().put("webflow.originatingViewState", this);
boolean stateExited = context.handleEvent(event);
if (!stateExited && context.getExternalContext().isResponseAllowed()) {
if (context.getExternalContext().isAjaxRequest()) {
render(context, view);
} else {
context.getExternalContext().requestFlowExecutionRedirect();
if (shouldRedirect(context)) {
context.getExternalContext().requestFlowExecutionRedirect();
} else {
render(context, view);
}
}
}
} else {

View File

@@ -183,6 +183,26 @@ public class ViewStateTests extends TestCase {
state.resume(context);
assertTrue(context.getFlowExecutionContext().isActive());
assertEquals(1, action.getExecutionCount());
assertFalse(context.getMockExternalContext().getFlowExecutionRedirectRequested());
}
public void testResumeViewStateForEventStateNotExitedNonAjaxRedirectEnabled() {
Flow flow = new Flow("myFlow");
StubViewFactory viewFactory = new StubViewFactory();
ViewState state = new ViewState(flow, "viewState", viewFactory);
Transition t = new Transition(on("submit"), null);
TestAction action = new TestAction();
t.setExecutionCriteria(new ActionTransitionCriteria(action));
state.getTransitionSet().add(t);
MockRequestControlContext context = new MockRequestControlContext(flow);
context.setAlwaysRedirectOnPause(true);
state.enter(context);
context = new MockRequestControlContext(context.getFlowExecutionContext());
context.setAlwaysRedirectOnPause(true);
context.putRequestParameter("_eventId", "submit");
state.resume(context);
assertTrue(context.getFlowExecutionContext().isActive());
assertEquals(1, action.getExecutionCount());
assertTrue(context.getMockExternalContext().getFlowExecutionRedirectRequested());
}