Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

java - logout handling in eclipse RAP application

In my RAP application I need to do some logout handling (forward do keycloak sso/logout). Where would be a good hook to do that?

org.eclipse.ui.application.WorkbenchAdvisor.postShutdown() is executed also if I refresh my browser window (F5), I don't want the session to logout on-refresh.
Rather if the session is expired or the browser window is closed.
Is there a hook for expired sessions or a session invalidation event?

Found UISessionListener.beforeDestroy() but it also is executed on browser-refresh:

RWT.getUISession().addUISessionListener(new UISessionListener() {
    @Override
    public void beforeDestroy(UISessionEvent event) {
        System.out.println("UISessionListener.beforeDestroy" + event);
    }
});

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Code show that UISessionListener catch the event UISessionEvent that contains UISession. This object is bound to HttpSession, if you don't wont to expire just configure session to endless(better to make it quit long but not endless depends on amount of users using application).

HttpSession has expiration time by default (for example for apache tomcat it is 30m). But it is configurable. Session expired when not single "touch" of session (request) in such timeout occurs.

Also by default session will "survive" during tab close/open, since cookie saved on client side (again this behaviour configurable).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...