• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About chain.doFilter()

 
Tang Yue
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 860 of Head First 2nd edition , it says that "if nothing else,doFilter() must invoke chain.doFilter()."

But on page 733, the book also says chain.doFilter() is not mandatory.

So what's the correct answer?
 
Ander Rodriguez
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must return chain.doFilter(req,resp) if you want to proccess the request, but if you don not want to continue proccesing because you have detected request is invalidad (or something like this), you do not call chain.doFilter(). You can use response object to send error, write html, etc... without calling chain.doFilter().

It is not mandatory.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic