Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSF 1.2 Session Timeout Issue

843844May 20 2010 — edited Sep 10 2010
I am using using:
JSF- Sun RI (1.2)
Websphere (6.1)
Facelets (1.?)
RichFaces (3.3.2)

I am having an issue with session timeouts that shows up in two different ways:
Scenario 1) the client makes an ajax call after the session has timed out
Scenario 2) the client makes a standard request after the session has timed out - navigating to a new page

I seem to be able to address one or the other, but I can't seem to find a solution that fixes both scenarios.

For Scenario 1, I have the client-side A4J.AJAX.onExpired function defined and that is currently working for session timeouts that are discovered via an ajax request.

However, if I start making changes to try and address the other scenario, it seems to break the A4J javascript function.

For Scenario 2, I have tried a number of suggestions that I've found online:
1) I've tried to configure the error page in web.xml:
<error-page>
<exception-type>javax.faces.application.ViewExpiredException</exception-type>
<location>/timeout.jsf</location>
</error-page>
However, anything I seem to try around this solution still winds up with a ViewExpiredException. I've tried to have timeout.jsf redirect to the login page and I get a ViewExpiredException on the login page when the redirect happens. I've tried to just render a timeout page with a link the user can click on to go to the login page and that fails as well.
2) I've tried the phase listener and had little success too.
3) I tried a NavigationHandler

One thing I did have working, I believe, was with the phase listener approach, but I had a difficult time displaying a session timed out message upon redirect, but not the first time the user visited the page.

I'm relatively new to JSF and probably don't understand the app life cycle well enough, I guess, but is there a solution that addresses all of these issues:
1) works for AJAX calls
2) works for actual navigation
3) sends the user back to the login page with some indication as to "why", but gracefully handles the first visit to the login page (or a logout)

Thanks for any suggestions you can offer.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 8 2010
Added on May 20 2010
15 comments
2,738 views