> > On 2/27/06, Elam Daly <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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

Reply via email to