• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EPractice Lab mock exam 1 question 47

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

EPractice Labs Skill Evaluation Lab wants to measure number of concurrent sessions. The team decided to use Java EE listener to track the logged in sessions. The listener must be plugged into the application with the help of web.xml without touching any other code. Which of the following listener can be configured in the deployment descriptor to achieve the above requirement?
A. HttpSessionAttributeListener
B. HttpSessionActivationListener
C. HttpSessionBindingListener
D. All of the above
The answer is A.
Explanation:
HttpSessionAttributeListener interface can be implemented in order to get notifications of changes to the attribute lists of session within a web application.....



I think none of the above. What if there is no attribute added, replaced, removed in any of the sessions? The purpose is to count how many concurrent sessions. But if those sessions does not fire the events, we cannot track the number of sessions.
 
Stefan Evans
Bartender
Posts: 1807
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well there is no answer for "none of the above" so you pick the best one available.
This question does make the assumption that some attribute is stored in the session at some point.


But given the requirement of "configure in web.xml", A is the only answer, because it is the only one of those listed that is configured there


 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Stefan,
Thanks.
So, there must be an assumption that some new attributes are added or some attributes are removed or replaced when there is a new session created.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic