i found a solution to safely invalidate a session in a safe an correct way.
What do you need:
- An application bean
- A little javasrcipt-fragment
In the application bean you should register the session-object you want to invalidate. I do this by simply call an method of my application bean with the session reference. The application bean holds this ref in an own variable.
The application bean itself has a thread. This can be startet from anywhere. I start this thread after registering the session. This thread releases the currently registered session delayed (> 100ms). This gives the framework the time to end the current phase.
<ice:commandButton action="#mybean.invalidate" onclick="setTimeout('location.reload();', 1500);"