Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29220
    
135

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,

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: load-on-startup for filter
 
Similar Threads
load on start up
Why does JSP compilation take so long?
Deploy struts app
<load-on-startup> Confusion?
What does load-on-startup?