• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filter init() method

 
Prasad Shindikar
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like the servlets, is a filter init() method always guaranteed to run before the filter handles any requests ?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javadocs of the Filter.init method contain the answer to this question.
 
Prasad Shindikar
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks !
i got the answer.. so the init() runs, only once and is called before the filter can do any filtering work.
 
Prasad Shindikar
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
but this leads to one question
Which about filters is true ?

Filters support an initialization mechanism that includes an init() method that is guaranteed to be called before the filter is used to handle requests.

This particular option seems to be right!

But in HFJS, this option is not ticked. Page 699, Question 5
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(703) question 5;
option D should be checked.
-HFSJ Errata (The latest reprint already fixed this.)

Keep the errata handy. In fact, it wouldn't hurt to pencil in corrections as you complete each chapter.
 
Prasad Shindikar
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.. will read the errata.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic