gwt-rpc delay window refresh -


i have following code in onmoduleload() of application:

    window.addwindowclosinghandler(new closinghandler() {         @override         public void onwindowclosing(closingevent event) {             event.setmessage("if choose close, application sign out");         }        });      //sign out on close     window.addclosehandler(new closehandler<window>() {         @override         public void onclose(closeevent<window> event) {             sendlogout();         }     }); 

the sendlogout() function looks this:

// set callback object.     asynccallback<string> callback = new logoutcallback(this);     // make call survey service.      surveysystemservice.util.getinstance().logout(details, callback); 

where 'details' object.

it works fine when window closed, if try refresh page, doesn't log out. figured since call asynchronous, doesn't finish getting message off server before module restarted.

i've tried: 1. creating , calling callback inside onclose method. 2. using timer check if call made. 3. endless loos check same above (i got desperate).

in of these solutions, program reach callback creation, server never received anything.

any this?

can call logout time page first loads. due stateless nature of web gwt application not know difference between hitting refresh or navigating page.

you can store id variable in session storage should maintained until browser window or tab closed. if on application start id variable exists in session storage can use trigger log out.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -