[prev in list] [next in list] [prev in thread] [next in thread] 

List:       tomcat-user
Subject:    Re: Session.getId() throws IllegalStateException
From:       Remy Maucherat <remy.maucherat () gmail ! com>
Date:       2006-01-31 22:48:50
Message-ID: 6d959d480601311448q1e38107drae429551a24087d3 () mail ! gmail ! com
[Download RAW message or body]

On 1/31/06, Blair Cooper <bcooper@rim.com> wrote:
> The following code generates an exception when getId() is called with
> Tomcat 5.5.15. In 5.5.7 it returned the session id.
>
> I realize that the session is being invalidated, thus valueUnbound()
> being
> called. I also realize that the servlet spec/errata says that this
> exception should be thrown when the session is invalid. I would contend
> that; at the time valueUnbound() is called the session should still be
> considered valid.

valueUnbond is called after the session has been invalidated.

> In our code we need to know which session is being invalidated in order
> to
> do some cleanup. Any chance that Tomcat would be changed/fixed to not
> mark
> the session as invalid until it has finished notifying the
> HttpSessionBindingListeners?

No (it was the same timing before, but Session.getId didn't throw an
exception), but I agree the change was a very bad decision. Hacking
Tomcat to remove the if (valid) is Session.getId is the way to go.
Other workaround: get the session id in valueBound and store it in a
field of your object.

--
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic