Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is HttpSessionActivationListener configured in DD?

 
Edmund Yong
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the HFSJ errata page at:

http://www.oreilly.com/catalog/headservletsjsp/errata/headservletsjsp.confirmed

There is an error in page 254 of the page, which 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."

The book itself explained that, unlike the HttpSessionBindingListener, the HttpSessionActivationListener should be configured in the DD.

If HttpSessionActivationListener is not configured in the DD, as pointed out in the errata, then how is it configured?

Thanks in advance.
 
S.L.Narayanan
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nopes. HttpSessionActivationListener has to be configured in DD. Only HttpSessionBinding listener doesnt need any DD configuration.
 
Edmund Yong
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In that case, the errata is wrong, isn't it?
 
David Bridgewater
author
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the errata slip is right.
It's the object which is a session attribute value which implements this interface.
Here's part of the API doc for HttpSessionActivationListener:
"Objects that are bound to a session may listen to container events notifying them that sessions will be passivated and that session will be activated. A container that migrates session between VMs or persists sessions is required to notify all attributes bound to sessions implementing HttpSessionActivationListener."
It's the objects that do the listening (not the container) - so no need for a DD entry.
 
Edmund Yong
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi David,

That's what I suspected, and I've searched the Internet and found that it's true. HttpSessionActivationListener should NOT be configured in the DD.

But seriously, how can the authors of HFSJ make such an obvious mistake? In this case, the errata should contain a lot more because all the stuff mentioned in 2 or 3 pages in the book about HttpSessionActivationListener are wrong! For example, it mentioned that HttpSessionActivationListener can be implemented by an attribute classes as well as other classes. It should just be attribute classes, right?
 
sergio mendez-rueda
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Edmund Yong:
Hi David,

That's what I suspected, and I've searched the Internet and found that it's true. HttpSessionActivationListener should NOT be configured in the DD.

But seriously, how can the authors of HFSJ make such an obvious mistake? In this case, the errata should contain a lot more because all the stuff mentioned in 2 or 3 pages in the book about HttpSessionActivationListener are wrong! For example, it mentioned that HttpSessionActivationListener can be implemented by an attribute classes as well as other classes. It should just be attribute classes, right?


Hi,
read the specification. No problem
 
David Bridgewater
author
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Edmund...

"It should just be attribute classes"
- yes (IMHO).

"how can the authors of HFSJ make such an obvious mistake?"
- even Homer nods!

Best,

David.
 
Lubos Vrba
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Today I've passed the SCWCD exam and I can bet according the exam the HttpSessionActivationListener must be placed in DD. I had to choose one from these listeners which is needed in DD:
HttpSessionBindingListener
HttpSessionActivationListener
HttpSessionTimeoutListener
HttpSessionPassivationListener
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No need to declare it. An attribute implementing it will be notified.
Both HttpSessionActivationListener and HttpSessionBindingListener do not need to be declared. Objects implenting those will be automatically notified.
 
Venkat Perumalla
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think if author can clear such ambiguous questions, itcould be helpful,If such questions were on the exam how shd we answer them?
Shd we choose HTTPSessionActivation Listener shd be declared in DD for exam
as the right option ?
[ October 06, 2006: Message edited by: Venkat Perumalla ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please believe me
 
Bryan Basham
author
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Satou kurinosuke:
Please believe me


Hi all,

You can believe Satou on this one. The HFS book is in error on this matter as the errata has confirmed. I take personal responsibility for not catching this error during proofing the book before we went to press.

Sincere regards,
Bryan
 
nav katoch
Ranch Hand
Posts: 246
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's still there in the 2nd edition at page 256. Please be careful who are studying from the new edition.

Thanks and regards,

Naveen Katoch
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic