I have a backing session scope bean called WorkSession
. When instance of this bean is created I call initialization function (declared with @PostConstruct
annotation), which changes current user (I handle user logging with JASS) status in database to ONLINE
.
I want to do analogical thing when user logs out (change user status to OFFLINE
). It is easy to do this when user presses button "Logout" on web page. The problem is that i have no idea how to detect closed browser or tab in browser.
I see that method with annotation @PreDestroy
does not work for this, because it's called by application server garbage collector, right?
I use Glassfish 3.1.2, JPA 2,0 and JSF 2.0.