Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HttpSessionActivationListener

 
Harish Yerneni
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If some other class(page 262) implements this listener, shouldn't this listener be registered in the DD.

OR

HttpSessionActivationListener is only implemented by an attribute class?

Thanks,

Harish
 
Daniel Dalton
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No SessionActivationListener is not configured in the Deployment Descriptor.
If a class implements this interface and is bound to a session (as an attribute), the container will see to it that the attribute is notified when the session activates or passivates.

If it WAS configured in the DD, how would you specify the attributes concerned???
 
Harish Yerneni
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understood your point. So, on page 262 only an attribute class should be checked and not some other class in column under "usually implemented by".
for HttpSessionActivationListener.

Right?

Thanks,

Harish
 
farihah noushene
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In HFSJ it's given that we need to specify HttpSessionActivationListener in DD. I think only HttpSessionBindingListener need not be specified. AM i right?
 
Daniel Dalton
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nope - don't think so. I'm open to correction, but I believe that there are TWO listeners that don't get configured in the DD, namely HttpSessionActivationListener and HttpSessionBindingListener. The container uses introspection to determine which attributes implement the interface and calls the appropriate methods.

There MAY be lots and lots - hundreds, thousands... of attributes bound to a session. Each may be of a different class, and each may need to know when it's bound/unbound to the session and also when the session is being migrated to a different JVM.

The other listeners are about life-cycle events effecting the whole app, rather than events so that this little class here can do it's own thing about being shunted around by the container!
 
David Bates
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's an error in the book. It should read:

"You do NOT configure session binding listeners OR SESSION ACTIVATION LISTENERS in the DD! ... But this is NOT true for the other session related listeners on the previous page. HttpSessionListener and HttpSessionAttributeListener must be registered in the DD, since they're related to the session itself, rather than an individual attribute placed in the session."

However, what if the implementing class isn't an attribute (which Pg 262 says it may be). Surely *that* class would need to be registered so that the container knows to notify it that the session is about to move?
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic