• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

What's order in web container for starting up?

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have listeners, filters, servlets defined in web.xml and I'd like to know what's the order for instantiatons?


Is the order starting from listener--> filter-->servlet correct?

(I have print statement in my ContextInitializedI(), so I know each time when I modified web.xml , it output the statment in console,..)

anybody can help me ?

Thanks
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
listener--> filter-->servlet

any idea?
 
Grace Yang
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any suggestion, any body knows?

Thanks
 
Ranch Hand
Posts: 10192
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good question. Even I'm interested in getting to know this!
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer to this can be determined simply by putting print statements into all those classes, can it not?
 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Per SRV 9.12 of Servlet Specification,

When a web application is deployed into a container, the following steps must be performed, in this order, before the web application begins processing client requests.

1. Instantiate an instance of each event listener identified by a <listener> element in the deployment descriptor.

2. For instantiated listener instances that implement ServletContextListener, call the contextInitialized() method.

3. Instantiate an instance of each filter identified by a <filter> element in the deployment descriptor and call each filter instance�s init() method.

4. Instantiate an instance of each servlet identified by a <servlet> element that includes a <load-on-startup> element in the order defined by the load-onstartup element values, and call each servlet instance�s init() method.

I hope this answers your question.
 
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember LCFS

LCFS means Listener -> ServletContextListener -> Filters -> Servlets
 
Grace Yang
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it.

Thank you all of you!!!
 
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic