Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using Global ServletContextListener in several modules in the webapp

 
Meir Yan
Ranch Hand
Posts: 599
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all
i have Global class named WebServerContextListener that implements the ServletContextListener
this class load every time the webapp load via the web.xml. now this has some Global settings that needs to be set for the overall webapp
but there is several modules in my web app that needs to do stuff when the application loads. but i dont want to write more classes in the web.xml
i like to use somehow this Global WebServerContextListener for setting stuff from modules . if i just extend this class it will not work .
is there some pattern or way to do that ?
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use WebServerContextListener for configuring all your modules ?
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use WebServerContextListener for configuring all your modules ?


Never heard of this listener, Rahul can you throw more light on this one.
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WebServerContextListener is what original poster Meir Yan is talking about.

 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ohh ok..

I thought it is some listener you are talking about..
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing keeping you from instanciating all of your configuration objects from a single context listener.

Having separate listeners is nice if you want the ability to add,remvoe, and reorder all of these actions without having to re-compile anything by simply editing your deployment descriptor. If you don't need this ability, by all means do everything from one listener.
 
Meir Yan
Ranch Hand
Posts: 599
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont want edit the web.xml
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic