Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubts

 
JPraveen Kumar
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will answer your second question, yes. Because before session is invalidated, all attributes associated with the session are removed.

Shiang
 
Lalitha Mouli
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3367
11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic