This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization 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: 34095
337
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: 2687
36
  • 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