File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doFilter method

 
amarkirt saroay
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HOw can we say that doFilter method is both a callback and an inline method?
 
Tripati Sahu
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A callback method, in the context of Web applications, is a method invoked by the container rather than by your own code. For example, you never invoke a servlet's service method yourself, instead the container does that for you when a client makes a request. In general, you'll write the callback method's implementation but never invoke it.

I imagine what's meant here by an "inline method" is one which you invoke directly in your own application's code: this may or may not be a method you have implemented yourself. For example, getServletConfig() is an "inline method" (I imagine). I may have that incorrect as I find it somewhat confusing terminology (for example, an invocation of an inline method in C++ is replaced by the expanded form of the method on compilation, a "feature" which doesn't exist in Java).


But the doFilter method can be called by ourself by writting chain.doFilter() as well as the container.
 
amarkirt saroay
Ranch Hand
Posts: 167
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it like?

Filter.doFilter() is a callback wheras Filterchain.doFilter() is inline method?
 
Tripati Sahu
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose we have a chain of filter. the first filters doFilter method will be called by contained and the inside the doFilter method of the first filet we can call another Filters doFilter method by calling filterChain.doFilter. The first one is call back and the second one is inline. Hope it clarifies.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic