Forums Register Login

Call back and inline functions

+Pie Number of slices to send: Send
Hi

What are container call back functions and the inline functions. What are difference in these two

Thanks
+Pie Number of slices to send: Send
Container callback methods are those that you write expecting that the container will call them. Inline methods, as you are calling them, I believe are methods that you call.

As an example, see in the Filter API that each of its 3 methods are called by the container - they are all container callback methods.
[ March 14, 2007: Message edited by: Marc Peabody ]
+Pie Number of slices to send: Send
 

As an example, see in the Filter API that each of its 3 methods are called by the container - they are all container callback methods.



The doFilter() is a callback functiona as well as an inline function

Am I right
+Pie Number of slices to send: Send
 

The doFilter() is a callback functiona as well as an inline function


No, doFilter is a callback function called by the web container.
+Pie Number of slices to send: Send
Pg 700, K&B mentions doFilter as both callback and an inline function. The reason could be is because apart from getting called by the container, the devloper himself could put in a call to doFilter(request,response) to call the next filter/servlet in chain.
[ March 14, 2007: Message edited by: Aniket Patil ]
+Pie Number of slices to send: Send
Satou
I have seen a question about callback functions in filter API in Filters chapetr of HFSJ book. In the answer the destroy()is selected as callback function.
On other thing is that we call chain.doFilter() to invoke next filter in chain. Is this call not making doFilter() an inline method.

Anyone please confirm

Thanks
+Pie Number of slices to send: Send
I would call FilterChain.doFilter an "inline" function as it's being called, but not Filter.doFilter. I don't think that you ever call it directly.
+Pie Number of slices to send: Send
You should be more specific when asking. If I'm correct, question is :
Q1: Which are true about filters?
C. The doFilter method is always a container callback method.

They don't specify which doFilter it is. Question is about filters, not the Filter class only.

Filter.doFilter is a container callback, but FilterChain.doFilter is an inline method. A dirty trick, which fortunately won't have at the exam
+Pie Number of slices to send: Send
Greate explanation Satou
I've never won anything before. Not even a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 974 times.
Similar Threads
private methods
Does final method really improves performance
How to call a function located in another js file?
History issue and JavaScript
CallBack functions....
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:16:18.