You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael Sudkamp <mi...@docware.de> on 2004/09/02 10:47:06 UTC

ServletContextListener and HttpSessionActivationListener

Hello,

I try to correctly reinitialize my sessions after a session deserialization. For this I try to use the ServletContextListener and the HttpSessionActivationListener. I use Tomcat 4.1.30.

>From testing I saw that during a startup (with a serialized session available) the sessionDidActivate() method is called prior to the contextInitialized() method.

Does this make sense? Shouldn't I be sure that the context is fully available when sessionDidActivate() is called. In this method I need some context attributes for correct reinitialization of my session attributes but these context attributes are null at that time.

The servlet 2.3 spec IMO gives no info about the sequence. What is your opinion?

Michael


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


AW: ServletContextListener and HttpSessionActivationListener

Posted by Michael Sudkamp <mi...@docware.de>.
> 
> We can talk opinions all we want -- if it's a grey area in 
> the spec, and
> your container (Tomcat, in this case) does things a certain way then
> that's how it goes.

But if people would agree with me we could try to get a next spec more specific. That's my intention.

> 
> Have you at least tried the 5.x series and/or checked Bugzilla?
> 

Yes, Tomcat 5.0.24 does the same

Michael


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


Re: ServletContextListener and HttpSessionActivationListener

Posted by QM <qm...@brandxdev.net>.
On Thu, Sep 02, 2004 at 05:44:14PM +0200, Michael Sudkamp wrote:
: It it is for that purpose, then IMO there must be fully initialized context at that point. I mean I must have had the chance to set up my own context attributes prior to this point.

We can talk opinions all we want -- if it's a grey area in the spec, and
your container (Tomcat, in this case) does things a certain way then
that's how it goes.

Have you at least tried the 5.x series and/or checked Bugzilla?

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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


AW: ServletContextListener and HttpSessionActivationListener

Posted by Michael Sudkamp <mi...@docware.de>.
I asked for your opinion because I wanted to know if anyone can imagine for what purpose the sessionDidActivate event is useful if not for reinitilization work after the session has become deserialized.

It it is for that purpose, then IMO there must be fully initialized context at that point. I mean I must have had the chance to set up my own context attributes prior to this point.

Michael


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


Re: ServletContextListener and HttpSessionActivationListener

Posted by QM <qm...@brandxdev.net>.
On Thu, Sep 02, 2004 at 10:47:06AM +0200, Michael Sudkamp wrote:
: From testing I saw that during a startup (with a serialized session available)
: the sessionDidActivate() method is called prior to the contextInitialized()
: method.
: 
: Does this make sense? Shouldn't I be sure that the context is fully available
: when sessionDidActivate() is called.
: [snip] 
: The servlet 2.3 spec IMO gives no info about the sequence. What is your
: opinion?

1/ Perhaps this really is a bug, and it's been fixed in Tomcat 5.x.
Setup a test instance and find out.

2/ I don't think "opinion" matters here -- if the servlet spec is shady on
it, containers are free to do as they please.   That leads me to...

3/ It may have been someone's idea that all session info should be
available for the ContextListener.  That would mean sessions would be
deserialized before a context starts and serialized after the context
stops, so a CL could gather some session stats. 

Who knows?  #3 is pure speculation on my part, so you may as well work
with #1 or #2  =)

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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