• 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

whether servlet of filter is instantiated first?

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
whether servlet of filter is instantiated first?
can anybody give me a link related to it?

thanks in advance
Loveleen Saroya
 
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I don't think any instantiation order of servlet and filters. The server/filters must loaded before exeucution of it's service/doFilter method.

We can define <load-on-statup> in DD to load the servlet at the start of the servlet.


Thanks
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is what the specification says:

When a web application is deployed into a container, the following steps must be
performed, in <b>this order</b>, before the web application begins processing client
requests.
� Instantiate an instance of each event listener identified by a <listener> element
in the deployment descriptor.
� For instantiated listener instances that implement ServletContextListener,
call the contextInitialized() method.
� Instantiate an instance of each filter identified by a <filter> element in the deployment
descriptor and call each filter instance�s init() method.
� 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.


So filters are instantiated before Servlets.
 
Narendra Dhande
Ranch Hand
Posts: 951
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sai,

Thanks for the valuable information. I missed it while reading the specifications as I skipped the ch 9. I was thinking that the container have map of all resources while loading the applicatin and it instantiated the listeners and filters as n when required to avoid the memory usage.

But the specs are very clear.

Thanks again.
[ November 18, 2005: Message edited by: Narendra Dhande ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic