users@javaserverfaces.java.net

Re: SJSAS : Application timeout happens, how do I redirect the user?

From: Raymond DeCampo <rdecampo_at_twcny.rr.com>
Date: Fri, 24 Aug 2007 19:37:49 -0400

Ryan Lubke wrote:
> Todd Patrick wrote:
>> Sun Java System Application Server Platform Edition 9.0_01 (build
>> b02-p01) running on Solaris 10
>> Java EE 5
>> JSF 1.2
>>
>> Use case:
>>
>> The user leaves the application open in their browser over night, the
>> application times out. When the user returns in the morning and clicks
>> on *any* link or button on the page - the user should be redirected to
>> the application login page.
>>
>> 1.) I'm sure this was thought of, what do I use in the Java EE 5 API to
>> accomplish this?
>>
>> 2.) Or, do I use a JSF Lifecycle PhaseListener?
>>
>> 3.) What really happens inside Sun Java System Application Server when
>> an application times out?
>>
> If you're using server side state saving and the user session times
> out, a
> javax.faces.application.ViewExpired exception is thrown.
> You could use the web application error-page functionality (defined in
> the web.xml)
> to create a page that will be forwarded to when the exception occurs.
> This page in turn
> can perform a redirect to the login page.
>
When attempting this in the past I created a nice infinite loop by
having the error-page be a JSF page. It seems that whatever was being
used to mark the request as a postback was not cleared. The workaround
was to use a regular JSP or HTML page.

Ray