I seem to have run into a wall with the SessionListener implementation in XPages. The listener prints the output to the log when creating the session, so I know it is correctly registered. However, upon exiting the system, it does not call sessionDestroyed. Is there any special URL redirect that I need to do to destroy a Domino / XPage session right after logging out? As you can see, I tried to clear the areas and clear the cookies, trying to run the sessionDestroyed method. Please note that sessionDestroyed is called when the http server task is restarted, so it seems that the sessions may be delayed until the time of inactivity expires.
Dev Server: 9.0.1 (64 bit running locally on Win7) Starting a single server based on session-based authentication (note: I tried basic auth, same problem)
Logout utility method (called by SSJS):
public static void logout(){
String url = XSPUtils.externalContext().getRequestContextPath() + "?logout&redirectto=" + externalContext().getRequestContextPath();
XSPUtils.getRequest().getSession(false).invalidate();
for(Cookie cookie : getCookies()){
cookie.setValue("");
cookie.setPath("/");
cookie.setMaxAge(0);
XSPUtils.getResponse().addCookie(cookie);
}
try {
XSPUtils.externalContext().redirect(url);
} catch (IOException e) {
logger.log(Level.SEVERE,null,e);
}
}
simple session listener:
public class MySessionListener implements SessionListener {
public void sessionCreated(ApplicationEx arg0, HttpSessionEvent event) {
System.out.println("***sessionCreated***");
}
public void sessionDestroyed(ApplicationEx arg0, HttpSessionEvent event) {
System.out.println("***sessionDestroyed***");
}
}
source
share