About Question enthuware.jwpv6.2.957 :

Moderator: admin

Post Reply
ArsenyKo
Posts: 11
Joined: Sun Apr 07, 2013 10:10 am
Contact:

About Question enthuware.jwpv6.2.957 :

Post by ArsenyKo »

Which interface should be implemented by a class so that its objects may receive notifications when they are put or removed from HttpSession?

This sounds for me as "receive notifications when instances of the class are being put or removed to the session". Nothing says that I should listen for all session attributes in a one place. So, I selected HttpSessionBindingListener and answered incorrectly (instead of HttpSessionAttributeListener).

Is it confusing for someone else, or I didn't get it due to my language issue?

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.957 :

Post by admin »

The problem statement is clear in this case. It says, "....so that its objects may receive...". So you don't care about any other class to receive those event. You want the objects of that specific class (the one whose objects you are adding to the session) to get those events.

HTH,
Paul.

ArsenyKo
Posts: 11
Joined: Sun Apr 07, 2013 10:10 am
Contact:

Re: About Question enthuware.jwpv6.2.957 :

Post by ArsenyKo »

Hi, Paul.

Yes, your explanation suits the problem statement, and I understand it as you explained :). But, the key phrase that confused me was " its objects". It means "many instances of the class", doesn't it?

If it's true, than my thought is the instance should be of a type that should implement X interface in order to be notified "when they are put or removed from HttpSession".

And, instance of a type HttpSessionAttributeListener is listening for many attributes regardless they implement the interface or don't.
But instance of a type HttpSessionBindingListener will be notified "when they are put or removed from HttpSession".

Just wanted to explain my train of thought.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests