Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mistake in JavaDocs(JDK1.4) regarding Listeners

 
Kevin Thompson
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that I found a mistake in the JavaDocs. I was studying the API for the various listeners and comparing to the Servlet Specifications.
Servlet Specifications (SRV.10.2.1):
Has a table SRV.10-1 "Events and Listener Interfaces" and indicates 4 listeners =>
javax.servlet.ServletContextListener
javax.servlet.ServletContextAttributeListener
javax.servlet.http.HttpSessionListener
javax.servlet.http.HttpSessionAttributeListener
Specification (SRV.10.3.2)Deployment Descriptors says =>
Listener classes are declared in the web application deployment descriptor using the listener element. They are listed by class name in the order in which they are to be invoked.
JavaDocs for ServletContextListener ==>
... "To receive notification events, the implementation class must be configured in the deployment descriptor for the web application".
JavaDocs for ServletContextAttributeListener ==>
... "To receive notification events, the implementation class must be configured in the deployment descriptor for the web application".
JavaDocs for HttpSessionListener ==>
... "To receive notifcation events, the implementation class must be configured in the deployment descriptor for the web application".
JavaDocs for HtttpSessionAttributeListener ==>
... (nothing - this is an error of ommission)
What the JavaDocs for HttpSessionAttributeListener SHOULD SAY =>
... "To receive notifcation events, the implementation class must be configured in the deployment descriptor for the web application".
////////////////////////////////////
Do people here agree with me? How do I report a mistake in the JavaDocs?
thanks!
Kevin Thompson
[ July 31, 2002: Message edited by: Kevin Thompson ]
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
submit a bug on sun site
 
Kevin Thompson
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok - I submitted it as a bug with Sun. If they get back to me about it, I will post the info here.
thanks
Kevin Thompson
P.S. And of course I made a mistake in the title of my original post here on JavaRanch.
The actual location of the error within the JavaDocs is =>
J2EE SDK 1.3.1 FCS
(Java Servlets 2.3)
[ July 31, 2002: Message edited by: Kevin Thompson ]
 
Yu Chen
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. How would I declare/register other listeners, like HttpSessionActivitionListener or HttpSessionBindingListener? Is deployment descriptor the only way to register listeners?
2. What are differences between HttpSessionAttributesListeners and HttpSessionBindingListener? Both are listenering to the HttpSessionBindingEvent triggered by either setAttribute() or removeAttribute(), WHEN should I use WHICH?
Thanks in advance.
-yu chen
 
R K Singh
Ranch Hand
Posts: 5384
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this out ...
GUI for experiment
====================================
Servlet

====================================
Listeners classes
================ HttpSessionBindingEvent =================

==================== HttpSessionAttributeListener, HttpSessionListener ===============

compile and run it
 
Jason Chaw
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, guys, I think the JavaDocs is all right.
Please refer to the comments by Roseanne Zhang
in Aleks Pascoal's "HttpSessionActivationListener" topic,
There are two listerner interfaces not needed to configuared in web.xml:
javax.servlet.http.HttpSessionBindingListener
javax.servlet.http.HttpSessionActivationListener
 
Kevin Thompson
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There IS a mistake in the JavaDocs. I did read the post by Roseanne Zhang in Aleks Pascoal's "HttpSessionActivationListener" topic. That is why I found the error in the JavaDocs!
The JavaDocs has an error of ommission in the text for HttpSessionAttributeListener. (as I outlined in my original post here).
Roseanne Zhang was absolutely correct.
There are 4 listeners that require web application deployment descriptors as follows:
1. ServletContextListener (JavaDocs correct)
2. ServletContextAttributeListener (JavaDocs correct)
3. HttpSessionAttributeListener (has ERROR OF OMMISSION in JavaDocs)
4. HttpSessionListener (JavaDocs correct)
There are 2 listeners that do not require web application deployment descriptors as follows:
1. HttpSessionActivationListener (JavaDocs correct)
2. HttpSessionBindingListener (JavaDocs correct)
YU Chen: I don't know how to answer your questions.
Jason Chaw: I see you are certified as an "Oracle Certified Assistant". Do you have any links for that? I have not heard of that certification before? Could you give me some info? Thanks!
Kevin Thompson
[ August 03, 2002: Message edited by: Kevin Thompson ]
 
Jason Chaw
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, kevin, I made a wrong spelling: "Associate" to "Assistant", thought they are synonymous.
This is the first level certification of the Oracle DBA. Two exams needed: PL/SQL and Database Fundamentals I. I think OCA is enough for me as a developer. The tests helped me a lot to learn the basic knowledge of Oracle Database.
I also confuse about that two listener. I was lucky to pass the exam. I will do some tests about it. see you.
 
Yu Chen
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ravish Kumar's codes, I did some experiments with a few cases:
Thompson is right, there is a omission in JavaDoc. HttpSessionActivionListener must be declared in web.xml. And HttpSessionBindinerListener does not.
So as you listed before, 4 listeners need to be declared, and two others does not.
Here comes another ?, is it ok to declare inner classes as listners in web.xml? For example, I put MySessionAttribute and MySessionListener inside HttpSessionServlet as inner classes, and declare them as follows:
<web-app>
<listener>
<listener-class>chapter4.MySessionServlet.MySessionListener</listener-class>
</listener>
<listener> <listener-class>chapter4.MySessionServlet.MySessionAttributeListener</listener-class>
</listener>
...
I got error status: 404. In the tomcat log files, it does have ClassNotFoundException.
Any explainatins, ideas??
-yu chen
 
Hema Menon
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jason Chaw:

Please refer to the comments by Roseanne Zhang
in Aleks Pascoal's "HttpSessionActivationListener" topic,

Where can I find this(Aleks Pascoal's "HttpSessionActivationListener" topic)?
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here
 
Hema Menon
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Anthony! Somehow my search on this forum for HttpSessionActivationListner ended up giving some other results.
Thanks,
Hema
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic