webtier@glassfish.java.net

Handling ViewExpiredException

From: <webtier_at_javadesktop.org>
Date: Fri, 30 Apr 2010 07:37:24 PDT

Using GF v2.1, JSF, Facelets and Richfaces. Using container managed authentication and server state saving.

Problem:

When a user is logged in and the application is republished and then the user tries to access another part of the page this is exception is shown. First they are presented with the login page because the session is terminated (as expected) however after they log back in they get a ViewExpiredException. This is expected as well.

The problem I'm having is gracefully handling this exception. Ideally the user should be directed to their "home page" after logging back in. Using the <error-page> to catch the exception doesn't seem to work because when the user logs back in they get a blank page with a url: http://server:8080/j_security_check. I know that j_security_check is the servlet used for container managed authentication so I believe the url is correct but why it just sits there instead of doing the authentication and redirecting the user is beyond me.

Using a phase listener which listens to the RestoreView phase to check for a valid session doesn't seem to be working either. I can re-direct the user to their homepage but they still end up seeing this exception which makes sense. If I could tell the application server to rebuild the view then this would work.

I've done a lot of googling but haven't some up with anything that works yet so hopefully I can get some help here.

Thanks.
[Message sent by forum member 'cain05']

http://forums.java.net/jive/thread.jspa?messageID=399755