GeeCON Prague 2014*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubts" Watch "Doubts" New topic
Author

Doubts

JPraveen Kumar
Ranch Hand

Joined: Aug 31, 2004
Posts: 80
Hi. Pls answer the following queries,

a. Can the listener class have a non default constructor and an unaccessible default constructor (say provat etc.). In this case how would the listener code get fired?

b. In case of session timeout or session invalidate do the events defined in HttpSessionListener, HttpSessionAttributeListener, HttpSessionBindingListener get executed?

Regards JPraveen
Shiang Wang
Ranch Hand

Joined: Jun 20, 2003
Posts: 96
I will answer your second question, yes. Because before session is invalidated, all attributes associated with the session are removed.

Shiang


SCBCD, SCWCD, SCJP
Lalitha Mouli
Greenhorn

Joined: Oct 31, 2004
Posts: 6
a. Can the listener class have a non default constructor and an unaccessible default constructor (say provat etc.). In this case how would the listener code get fired?


Hi,
The listener class cannot have an unaccessible default constructor, I think it is because the container uses Reflection to instantiate the class, In case of tomcat , the application intialization itself fails , with the following message.

java.lang.IllegalAccessException: Class org.apache.catalina.core.StandardContext can not access a member of class com.example.ReqAttrListener with modifiers "private"

Cheers
mouli
SCJP1.4 SCWCD1.4(preparing)
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3211
    
    6
Originally posted by JPraveen Kumar:
Hi. Pls answer the following queries,

a. Can the listener class have a non default constructor and an unaccessible default constructor (say provat etc.). In this case how would the listener code get fired?


Regards JPraveen


Listeners MUST have default (no arguments) public constructor.

regards,
MZ


Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
 
GeeCON Prague 2014
 
subject: Doubts