This content has been marked as final.
Show 3 replies
-
1. Re: How to add FacesMessage when customized Session object is expired
janylj Mar 14, 2008 10:58 PM (in response to janylj)I also tried to throw Exception instead of catching events.
@Observer("org.jboss.seam.sessionExpired") public void sessionExpiredEventListener(){ throw new NotLoggedInException(); }
Then in the pages.xml, I added:
<exception class="org.jboss.seam.security.NotLoggedInException"> <end-conversation/> <redirect view-id="/login.xhtml"> <message severity="ERROR">In order for you to resume your activities, please Log In.</message> </redirect> </exception>
However, the NotLoggedInException() is thrown, then:
ERROR SeamPhaseListener.beforePhase:127 [] swallowing exception org.jboss.seam.security.NotLoggedInException
So when session expires, it doesn't even redirect to the login page.
-
2. Re: How to add FacesMessage when customized Session object is expired
janylj Mar 14, 2008 11:55 PM (in response to janylj)A couple clarifications of the original post. The sessionExpiredEventListener() should be:
@Observer("org.jboss.seam.sessionExpired") public void sessionExpiredEventListener(){ FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Your session expired. Please login again...",null); faceMessages.add(msg); Identity.instance().logout(); }
A user case is:
- Let mySession expire on abc.xhtml page.
- Before RESTORE VIEW phrase, the org.jboss.seam.sessionExpired event is raised, a FacesMessage is added to this.faceMessages. Then logout is called.
- Identity.instance().logout() redirects to login.xhtml page.
- I guess before RESTORE VIEW phrase of the login.xhtml page, the sessionListener bean is instantiated again, which cause this.faceMessages content is lost. If it's true, why? The sessionListener bean is HttpSession scope. Although mySession expires, but HttpSession is not expired, why this bean is re-constructed.
- Login page is rendered without the error message.
-
3. Re: How to add FacesMessage when customized Session object is expired
asioli May 3, 2011 3:43 AM (in response to janylj)Hello
Any luck solving this problem ? I think I have the same problem here... the Facesmessages don't survive the logout...
Cheers,
Paolo