aspose file tools*
The moose likes Servlets and the fly likes load-on-startup for filter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "load-on-startup for filter" Watch "load-on-startup for filter" New topic
Author

load-on-startup for filter

Tapan Maru
Ranch Hand

Joined: May 08, 2006
Posts: 65
Why don't we have load-on-startup for Servlet filters as we have it for servlets?


Tapan Maru
tapanmaru@gmail.com
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30953
    
158

My first thought was because filters aren't executed on their own and a servlet can run until all the relevant filters are loaded. THen I did an experiment and noticed that the filters are loaded on application startup. The servlets can be loaded on startup or on demand. In other words, you can't run anything until the filters are loaded so order doesn't matter.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Miku Ranjan
Ranch Hand

Joined: Oct 11, 2011
Posts: 98
Hi,
Can you show your web.xml code here .
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Miku Ranjan wrote:Can you show your web.xml code here .

What good would that do?
Tapan Maru
Ranch Hand

Joined: May 08, 2006
Posts: 65
Hi Jeanne,

Thanks for the reply. Yes I have also verified that Filter's init method is called on application startup by the container so no need to have load-on-startup kind of tag for it.

Thanks for Helping,

 
Consider Paul's rocket mass heater.
 
subject: load-on-startup for filter