voyent
Safe Session invalidation (HowTo)  XML
Forum Index -> Components
Author Message
dkohl

Joined: 02/Jun/2007 00:00:00
Messages: 13
Offline


Hi all,

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.

An auto-update after the session has been released is easily done by this short javascript-fragment placed in the onclick-method (in my case).

Code:
 <ice:commandButton  action="#mybean.invalidate"  onclick="setTimeout('location.reload();', 1500);"
 


In short:

mybean.invalidate registers the session object in an application-bean and starts the invalidation-thread for the delay. the javascript-code forces the reload of the page.


greetings
 
Forum Index -> Components
Go to:   
Powered by JForum 2.1.7ice © JForum Team