I have a drill down menu with top level categegories which contain a variable number of options, and I am using a conversation scoped stateful session bean to manage the menu's state. Because opening any of the top level categories may begin the conversation each corresponds to a toggleCategoryName() method annotated with @Begin(join=true). The problem is if a user begins to interact with the menu and updates it as so:
Category 1 -Option -Option Category 2 Category 3 -Option -Option
In other words, two categories are open and one is closed. Now if the user leaves to get a cup of coffee and comes back to an expired conversation, then clicks Category 2 to toggle it open they will end up with:
Category 1 Category 2 -Option -Option Category 3
This is a problem. What they would expect is to have all three categories open and what they get is a brand new conversation where only the second category has been toggled open. To make matters worse I don't see a way to catch this situation so that I can display some message indicating a conversation timeout occured. In this situation I can't use @Conversational(ifNotBegunOutcome="timeout") because the toggle methods all might be the first action called and therefore must be able to begin a new conversation.
I can see some possible hacks to this but what I'd really like is the ability to detect if the action was requested along with a non-valid conversation id. Maybe something along the lines of @Conversational(ifInvalidConverationRequestedOutcome="timeout"). Ok, that's maybe a bit verbose, but you get the picture. Even better would be a way to define an interceptor that could check if an invalid/expired conversation was requested and act appropriately (perhaps setting a message in the facesContext and returning to the last view). Is there a way to do this that I'm missing? I guess the real trick would be picking out the requested conversation id from within the action method, but I've looked the API doc over and I'm coming up short.