| Author |
Is HttpSessionActivationListener configured in DD?
|
Edmund Yong
Ranch Hand
Joined: Nov 16, 2003
Posts: 164
|
|
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.
|
SCJP 1.2, SCWCD 1.4
|
 |
S.L.Narayanan
Ranch Hand
Joined: Apr 01, 2005
Posts: 431
|
|
|
Nopes. HttpSessionActivationListener has to be configured in DD. Only HttpSessionBinding listener doesnt need any DD configuration.
|
SCJP 1.4, SCWCD 1.4, SCBCD 1.3, NEXT--->IBM XML
|
 |
Edmund Yong
Ranch Hand
Joined: Nov 16, 2003
Posts: 164
|
|
|
In that case, the errata is wrong, isn't it?
|
 |
David Bridgewater
author
Ranch Hand
Joined: Apr 29, 2004
Posts: 44
|
|
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
Joined: Nov 16, 2003
Posts: 164
|
|
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
Joined: May 12, 2005
Posts: 37
|
|
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
Joined: Apr 29, 2004
Posts: 44
|
|
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
Joined: Oct 05, 2006
Posts: 1
|
|
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
|
SCJP 5.0, SCWCD 1.4
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
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.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Venkat Perumalla
Greenhorn
Joined: Sep 19, 2006
Posts: 20
|
|
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 ]
|
Venkata Gawtham Perumalla<br />"Wise People Learn from their Mistakes Wiser People Learn from Others Mistakes"
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
Please believe me
|
 |
Bryan Basham
author
Ranch Hand
Joined: Apr 30, 2001
Posts: 199
|
|
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
Joined: May 02, 2008
Posts: 246
|
|
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
|
 |
 |
|
|
subject: Is HttpSessionActivationListener configured in DD?
|
|
|