Window close issues in gwt -ext

2019-08-29 13:24发布

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.

标签: java gwt gwt-ext
2条回答
姐就是有狂的资本
2楼-- · 2019-08-29 13:42

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();

查看更多
叛逆
3楼-- · 2019-08-29 14:03

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();
    }
    
查看更多
登录 后发表回答