• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HttpSessionActivationListener

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it necessary to register in the web.xml listeners that implements HttpSessionActivationListener?
I know that it isn't for HttpSessionBindingListener and that is for
ServletContextListener, ServletContextAttributesListener, HttpSessionAttributesListener and HttpSessionListener.
Thanks,
Aleks
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep, You need to register in the web.xml using the listener tag.
This process is almost exactly the same as with other listeners.
The listener must be defined in the web.xml for all the possible
servers.Remember, the activation method and passivation methods
will probably be called on different systems.

Raj
 
Aleks Pascoal
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you sure about that?
So, only HttpSessionBindingListener doesn't have to be register?
 
raj sekar
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please refer Java 2 Web Developer Certification Study Guide
by Natalie Levi, Philip heler
Chapter 4: The Servlet Model , Page 143.
It clearly explains that HttpSessionActivation listener needs to be
registered in the Deployment Descriptor file.
Thanks,
Raj
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't have the book. However, if the book said that, then the book is wrong.
Read Servlet SPEC: SRV.10
Only four listeners are life cycle listeners, not five.
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if i would you, i would not trust this book too much:
Java 2 Web Developer Certification Study Guide
It has lots of mistakes here and there.
I read most of the books already. i have to say, it needs to be proof read few times before publishing it.
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are famous for putting books on the market real real fast with huge amount of error. Unsuspicious buyers made them real real rich...
In 1999, The first print of Java 2 Certification Study Guide (SCJP) had 10 or 15 pages errata, and then errata for errata’s
I put a very bad comment on amazon, they were too afraid to publish it. However, amazon then did give the first print buyers second print for free. Even so, it still contained many errors.
Money, it is the drive force in their books. You might say that's normal. However, what is their responsibility?
[ July 24, 2002: Message edited by: Roseanne Zhang ]
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
At least, I will never rush into the bookstore to buy their first print any more...
 
Joe Man
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i wish i know this earlier. I think i wasted $40 or so. I think the SCWCD study kit from Manning is good enough for me.
 
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Who is the publisher?
Sometimes I bought bad books maybe I should check publisher first.
Thanks.
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Roseanne Zhang:
I don't have the book. However, if the book said that, then the book is wrong.
Read Servlet SPEC: SRV.10
Only four listeners are life cycle listeners, not five.


Surprisingly the Mannings's Book is also wrong on the same topic (p.433)
The correct answer is given by BEA here
search for HttpSessionActivationListener

Note: The Servlet 2.3 specification also contains the javax.servlet.http.HttpSessionBindingListener and the javax.servlet.http.HttpSessionActivationListener interfaces. These interfaces are implemented by objects that are stored as session attributes and do not require registration of an event listener in web.xml. For more information, see the Javadocs for these interfaces.

 
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
WTF! I bought the manning book yesterday after reading all the comments....
Yes, on p433 it is wrong but on p485 it is explained correctly.
 
Roseanne Zhang
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
P449, question 9 answer wrong, should be b) since Any OutputStream does not have a print() method.
 
Enthuware Software Support
Posts: 4810
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Roseanne Zhang:
P449, question 9 answer wrong, should be b) since Any OutputStream does not have a print() method.


But response.getOutputStream() returns ServletOutputStream which has the print(String) method. It provides all sorts of print() methods so the given answer is correct.
 
Hey, I'm supposed to be the guide! Wait up! No fair! You have the tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic