Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ (P.700) Callback method vs. Inline method?

 
Feifei Long
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

What are the definitions of callback method and inline method?

In HFSJ, it says filter's destroy() method is a callback but doFilter() is both a callback and and inline.

I have no idea what that means? Can anybody explain this to me?

Thank you very much!
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
callback means the container calls it

inline means the programmer's code calls it

doFilter is called by the container but the programmer is also supposed to call it to pass things along through the FilterChain.
 
Feifei Long
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Marc!

doFilter is called by the container but the programmer is also supposed to call it to pass things along through the FilterChain.


Does it mean doFilter() of Filter class is a callback method, but doFilter() of FilterChain is an inline method?

Can programmer call doFilter() on Filter?

[ June 09, 2006: Message edited by: Feifei Long ]
[ June 09, 2006: Message edited by: Feifei Long ]
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Feifei Long:
Does it mean doFilter() of Filter class is a callback method, but doFilter() of FilterChain is an inline method?

Can programmer call doFilter() on Filter?


Yes and yes. But wait! A programmer could call doFilter on a Filter but that's pretty dangerous, as the programmer would also be taking on the container's responsibility to call the filter's init and destroy methods. Also your filter stack gets ugly and you have to deal with the ridicule of your coworkers.

It's best to just call on FilterChain and let the container do the dirty work.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic