h3. @org.icefaces.bean.AllWindowsClosed
Use the @AllWindowsClosed method annotation with session-scoped beans that need to be notified when all browser windows for that session are closed. This is useful in cases where the application wants to actively cleanup a user-session upon window close.
@AllWindowClosed annotation will work correctly as long the application is configured with org.icefaces.lazyWindowScope set to false or the application uses window scoped beans in its pages. By doing so the browser will notify the server every time a window is closed and eventually when all windows are closed, @AllWindowClosed annotated methods will be called.
{code:title=MySessionScopedBean.java with @AllWindowsClosed}
package org.icefaces.demo;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import java.io.Serializable;
import org.icefaces.bean.AllWindowsClosed;
@ManagedBean(name = "mySessionScopedBean")
@SessionScoped
public class MySessionScopedBean implements Serializable {
...
@AllWindowsClosed
public void allWindowsForSessionClosed(){
//clean up code goes here
}
{code}
Use the @AllWindowsClosed method annotation with session-scoped beans that need to be notified when all browser windows for that session are closed. This is useful in cases where the application wants to actively cleanup a user-session upon window close.
@AllWindowClosed annotation will work correctly as long the application is configured with org.icefaces.lazyWindowScope set to false or the application uses window scoped beans in its pages. By doing so the browser will notify the server every time a window is closed and eventually when all windows are closed, @AllWindowClosed annotated methods will be called.
{code:title=MySessionScopedBean.java with @AllWindowsClosed}
package org.icefaces.demo;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import java.io.Serializable;
import org.icefaces.bean.AllWindowsClosed;
@ManagedBean(name = "mySessionScopedBean")
@SessionScoped
public class MySessionScopedBean implements Serializable {
...
@AllWindowsClosed
public void allWindowsForSessionClosed(){
//clean up code goes here
}
{code}