This was the easiest solution I found:

First, use a JSNI call in your main entry class:

private static native void redirectToUrl(String prefix) /*-{

$wnd.location = prefix + “/index.jsp?logoff=true”;

}-*/;

This assumes you have a standard java servlet container log in

Then you call the jsni method inside your onModuleLoad method with a timer:

logoutTimer = new Timer() {

public void run() {

redirectToUrl(GWT.getHostPageBaseURL));

}

};

logoutTimer.schedule(60000*SESSION_TIMEOUT_IN_MINUTES);

 

You also have to have a declaration for logoutTimer and SESSION_TIMEOUT_IN_MINUTES in the declaration section of your class

Leave a Reply

Your email address will not be published. Required fields are marked *