File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Difference between methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Difference between methods" Watch "Difference between methods" New topic
Author

Difference between methods

raghu dubey
Ranch Hand

Joined: Jul 05, 2007
Posts: 72
HI,

Can you please tell me the difference between a callback mathod and a inline methods...Page 700...excplanation for Q1 in HFSJ

Thanks,


Thanks,<br />Raghu.<br /> <br />SCJP 5, SCWCD 1.4, NCFM
Charles Lyons
Author
Ranch Hand

Joined: Mar 27, 2003
Posts: 836
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).

Not having a copy of HFSJ, it would have helped me (and others without the book) if you had quoted the relevant paragraph(s) - it would help to put your question in context.


Charles Lyons (SCJP 1.4, April 2003; SCJP 5, Dec 2006; SCWCD 1.4b, April 2004)
Author of OCEJWCD Study Companion for Oracle Exam 1Z0-899 (ISBN 0955160340 / Amazon Amazon UK )
raghu dubey
Ranch Hand

Joined: Jul 05, 2007
Posts: 72
the question in the book says:

Which are true about filters:

1) The destroy method is always a container callback.
2) the doFilter method is always a container callback.
3) The only way a filter can be invoked is through a DD declaration.

and it said that the options 1 and 3 are correct. 2 is not correct because doFilter is both a container callback and inline method.

destroy is only called b y container, but doFilter can also be indirectly invoked using chain.doFilter() while we are doing a filter chaining. so it becomes an inline method as well.


Charles, I think I get that now from your explanation. The book explanation is "inline" with what you said.


Thanks,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between methods