Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

load-on-startup for filter

 
Tapan Maru
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't we have load-on-startup for Servlet filters as we have it for servlets?

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34179
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Miku Ranjan
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can you show your web.xml code here .
 
Tim Moores
Bartender
Posts: 2742
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Miku Ranjan wrote:Can you show your web.xml code here .

What good would that do?
 
Tapan Maru
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic