[jboss-user] [JBoss Seam] - Re: Difference between session timeout and not logged in yet

jacob.orshalick do-not-reply at jboss.com
Wed Nov 14 13:37:24 EST 2007


You have to make some assumptions here, but you can basically notify the user when the server session has ended with the following in a PhaseListener:

@Observer("org.jboss.seam.beforePhase")
  | public void beforePhase(PhaseEvent event)
  | {
  |   if(event.getPhaseId() == PhaseId.RESTORE_VIEW)
  |   {
  |     HttpServletRequest request =
  |       (HttpServletRequest) FacesContext.getCurrentInstance()
  |         .getExternalContext().getRequest();
  |             
  |     if(request.getRequestedSessionId() != null 
  |            && request.getSession().isNew())
  |        Events.instance().raiseEvent("org.myOrg.sessionExpired");
  | ...

Based on general cookie settings this will raise the event when the user still has the browser window open, the http session expired, and the user tries to access the app.  If the user closes and reopens the browser to start the application, the event will not be raised.

This of course makes the assumption that cookies expire when the browser  session is ended (which is generally the case).  Good luck.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104732#4104732

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104732



More information about the jboss-user mailing list