This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Clarify my doubt in listeners

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can anyone let me know the answer of this question. Thanks in advance.

Which of the following listeners are not configured in the deployment descriptor? Select two choices.

a. ServletContextListener
b. ServletContextAttributesListener
c. HttpSessionAttributeListener
d. HttpSessionActivationListener
e. HttpSessionBindingListener
f. HttpSessionListener
 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From my knowledge correct choice is only one not two
HttpSessionBindingListener.
Correct, me if I am wrong.
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also HttpSessionActivationListner
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Which of the following listeners are not configured in the deployment descriptor? Select two choices.

a. ServletContextListener
b. ServletContextAttributesListener
c. HttpSessionAttributeListener
d. HttpSessionActivationListener
e. HttpSessionBindingListener
f. HttpSessionListener



Correct options are D and E. Like HttpSessionBindingListener, there's no need to configure the HttpSessionActivationListener implementation class in the DD.

Regards,
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
According to Head First Servlets and JSP, HttpSessionActivationListener must be registered in the DD because it is directly related to the session and not to an attribute. (2nd Ed. Page 256). HttpSessionBindingListener does not need to be registered.
 
Kunal Jag
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

According to Head First Servlets and JSP, HttpSessionActivationListener must be registered in the DD because it is directly related to the session and not to an attribute.



Please check the errata list of your favorite book.

Regards,
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the errata :
[b]
Change the title to "You do NOT configure ALL session listeners in the DD!"[/b]


looks confusing. At first glance, i take it that ALL session listeners do not need any DD configuration!
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check that FAQ.
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HttpSessionActivationListener
HttpSessionBindingListener

These two listeners do not need to be configured in the deployment descriptor.

Here's an excerpt taken from David Bridgewater's post in javaranch (https://coderanch.com/t/170002/Web-Component-Certification-SCWCD/certification/HttpSessionActivationListener-configured-DD)
A 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.

For the 2nd you know the answer.
 
Did you ever grow anything in the garden of your mind? - Fred Rogers. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic