myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Kienenberger" <mkien...@gmail.com>
Subject Re: Session Expiration Default Target?
Date Tue, 28 Feb 2006 18:19:38 GMT
> > On 2/27/06, Elam Daly <elam.daly@gmail.com> wrote:
> >>how do I determine if a session has expired?

> Mike Kienenberger wrote:
> > You have to do something like this:
> >
> >             boolean expired = false;
> >             try
> >             {
> >                  session.getAttribute("anything"):
> >                  expired = false;
> >             }
> >             catch (IllegalStateException e)
> >             {
> >                 expired = true;
> >             }

On 2/28/06, Jonathan Harley <jon@parkplatz.net> wrote:
> No, in a filter you can just call session.isNew()

That would be incorrect, although you could possibly replace
getAttribute() with isNew() in the code above.


 public abstract boolean isNew()

    A session is considered to be "new" if it has been created by the
server, but the client has not yet acknowledged joining the session.
For example, if the server supported only cookie-based sessions and
the client had completely disabled the use of cookies, then calls to
HttpServletRequest.getSession() would always return "new" sessions.

    Returns:
        true if the session has been created by the server but the
client has not yet acknowledged joining the session; false otherwise
    Throws: IllegalStateException
        if an attempt is made to access session data after the session
has been invalidated

Mime
View raw message