Window close issues in gwt -ext

620 Views Asked by At

Hello all I am using gwt-ext in my application.In that application session time is 5 minutes. My issues is that If any window is open to render some information & in between session goes out then user logged out but the opened window is not closing in that case.

So just want to know that how close opened window while session is timed out and user is logged out.

Thanks in advance.

2

There are 2 best solutions below

0
On BEST ANSWER

You can follow these steps to close tour any open window at sesssion time out:

  1. Whenever you make an Object of Window: assign an Id to that Window.

    window.setId("myWindow");
    
  2. The place at which you're handling session time out, place this code:

    ExtElement extElement = Ext.get("myWindow");
    if (extElement != null && Ext.getCmp(extElement) != null
        && Ext.getCmp(extElement) instanceof Window) {
        Window window = (Window) Ext.getCmp(extElement);
        window.close();
    }
    
0
On

There is a class called Timer in GWT in which we can fire a request to the server at a regular interval of time.So that you can check on the server side for the session and when session is invalid you can reload the application to login page or nay othet page using Window.Location.reload();