The scenario is this:
a have some view-states. when an object in my conversationScope is in a certain state (e.g. not null) i want to prevent that the user can go back. by going back i mean: ether press the browser back button or manipulate the execution-parameter.
one way of "preventing" would be ignoring the request.
i have tried to implement a FlowExecutionListenerAdapter
but this has only access to the requestContext
, view
and viewState
so the question is: what and how is the best way to to this? Handler, Listener or Interceptor.
okay i solved it pretty dirty, but i solved it:
i wrote a FlowExecutionListenerAdapter
implementation, which throws an Exception
in the resuming
phase if the criterias match.
@Override
public void resuming(RequestContext context)
{
if (!backwardNavigation)
{
if (!context.getFlowExecutionContext().getActiveSession().getState().getId()
.equals(attributeConfigurer.getFinishViewState()))
{
throw new ConfirmationFinishRedirectException();
}
}
}
and i catch the exception with a transition in the state where it is thrown.
<transition on-exception="example.ConfirmationFinishRedirectException" to="finishState" bind="false" validate="false" history="discard"/>
i got the idea for this solution from this site: SpringForum - Thread: FlowExecutionListener - how to intercept and redirect user