added possibility to handle session expiration by your own
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/session-checker@93510 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
ae93c863fe
commit
5768e91010
|
@ -38,6 +38,9 @@ public class CheckSession {
|
|||
private String scope;
|
||||
private Timer t;
|
||||
|
||||
//we give the user the possibility to show the dialog or not
|
||||
private boolean showSessionExpiredDialog = true;
|
||||
|
||||
//needed to mask the page when session id up!
|
||||
private Div maskDiv = new Div();
|
||||
|
||||
|
@ -92,7 +95,13 @@ public class CheckSession {
|
|||
if (! (userValid && scopeValid) ) {
|
||||
mask(true);
|
||||
stopPolling();
|
||||
showLogoutDialog();
|
||||
if (showSessionExpiredDialog) {
|
||||
showLogoutDialog();
|
||||
} else {
|
||||
if (eventBus == null)
|
||||
throw new NullPointerException("Hey, it seems you chose to handle yourself session expiration "
|
||||
+ "but also not to get informed about it (eventbus is null) what's the point then?");
|
||||
}
|
||||
if (eventBus != null) {
|
||||
eventBus.fireEvent(new SessionTimeoutEvent(result));
|
||||
}
|
||||
|
@ -166,4 +175,11 @@ public class CheckSession {
|
|||
public void stopPolling() {
|
||||
t.cancel();
|
||||
}
|
||||
|
||||
public boolean isShowSessionExpiredDialog() {
|
||||
return showSessionExpiredDialog;
|
||||
}
|
||||
public void setShowSessionExpiredDialog(boolean showSessionExpiredDialog) {
|
||||
this.showSessionExpiredDialog = showSessionExpiredDialog;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue