Jan 28th, 2013, 09:37 PM
How to implement a global check and redirect or transition
We have a need for each request to check a "global" value (a cookie in this case) and send the user to a specific state/URL if it occurs, no matter which state they're currently in. Except, of course, it would need to be able to except its own state.
We've used an Interceptor in the past that redirects to a configured URL, but I don't like that it has forced me to have that URL be something outside the flow. (Since I couldn't come up with any way to except that URL itself. Trying to tack on an _eventId=globalTransition, I never found a working incantation.)
I considered FlowExecutionListener, but that doesn't seem to have any way to cause a specific transition/state. I had it throw an unchecked Exception thinking I could handle that declaratively, but it seems Exceptions thrown from there don't reach the SWF configuration.
I'm hoping I'm just missing some simple approach.
Jan 28th, 2013, 10:14 PM
Well... interesting. I had tried throwing my unchecked Exception from the requestSubmitted() method, which behaved as I described: the on-exception was not used.
But based on this other thread, I decided to try the resuming() method instead, and that worked. I imagine if I knew Web Flow lifecycle well enough, I'd know why, but since I don't, I'd love to be enlightened. It would also be good to know if what I'm doing is fragile.
Tags for this Thread