On May 6, 2008, at 6:44 AM, harbhanu wrote:
First of all I must say that it was a very concise and informative
reply...
That said, from what I understood the following are the interceptor
providers...
* Client
* Endpoint
* Service
* Bus
* Binding
Since these will plug there interceptor implementations in a layered
way, I
am curios to know the layered order in which they fit together,
along with
the default interceptor implementation that they provide?
This is actually on my list to look at once I get back from JavaOne.
There is a bug reported two weeks ago about the layering being
different for the fault chains than for the in/out chains and some
issues like that. I need to look into them to figure it all out and
make them consistent. That said, if the interceptors are all
programmed correctly, that layering shouldn't matter. The ordering
is pretty much controlled by the "Phase" the interceptor states it
goes in and then any before/after things it specifies.
One more ... As I can plug-in my interceptor in any of the layer but
shouldn't the interceptor be capable of handling the message as
passed by
the upper/lower layer interceptor.
So, doesn't any of the upper or lower layer interceptors provide any
protocol/rules for the message format at any particular layer...like
StAX
In-interceptor should expect that input message is an XML document...
Well, it kind of all depends on the Interceptor and the phase it's
stuck in. For example, the StaxInInterceptor expects to have an
InputStream in the message that it can create a XMLStreamReader
from. Most of the interceptors in the phases after the one the
StaxIn is in expect the XmlStreamReader to be there.
That said, you can write bindings and stuff that don't do any XML
stuff at all and use that with the core runtime. The JAX-RS frontend
kind of does that.
Also, it would be really helpful if someone can suggest a way to
debug the
CXF-Code
The BEST way to do this is to stick a breakpoint in
PhaseInterceptorChain.doIntercept method. Line 221 in CXF 2.1. From
there you can see each of the interceptors that are being called
during processing of the message.
Fundamentally, the processing of the message occurs just by iterating
through the Iterator<Interceptor> of the PhaseIntercceptorChain
calling each interceptors processMessage method. That's literally
all that the "core" does. The "bulk" of the work falls into creating
the Interceptor chain (collecting all the interceptors and putting
them in the proper order) and in the interceptors themselves.
Dan
Thanks!!
Regards,
Harbhanu
-----Original Message-----
From: Daniel Kulp [mailto:[EMAIL PROTECTED]
Sent: Monday, May 05, 2008 7:38 PM
To: [email protected]
Subject: Re: Reg. Interceptor states
On May 5, 2008, at 4:45 AM, harbhanu wrote:
I want to know more about the specifics of different states in the
interceptor chain to which an interceptor can be attached.
I have tried looking at the documentation but IMO it doesn't discuss
it in
depth.
According to the test that I did, the state transition is as follows
....snip.....
The phases are controlled by the PhaseManager in the Bus. If you
look in the PhaseManagerImpl.java at:
https://svn.apache.org/repos/asf/cxf/trunk/rt/core/src/main/java/org/apache/
cxf/phase
You can see the full list of phases that we have defined.
That said, you can easily configure new phases in there if you need
some additional work you want done.
If possible, please let me know about the message transformation
that takes
place.
Well, the interceptors themselves are the ones that do any
transformation or processing. All of the CXF functionality is done
via interceptors that live in the chain. Thus, any processing that
goes on is specific to the interceptors that are put in place by the
binding, the bus, the endpoint, etc..
Also, point me to any resource which discusses this in depth.
Couple more questions regarding interceptors:
How can I pass information between different layers of interceptors?
The Message object implements Map so you can store anything you want
on the message itself.
Alternatively, if you need information across the message exchange
(aka: you need information from the in interceptors to do some out
processing), you can store stuff on the Exchange (which also
implements Map) which is retrievable from the message.
How can I modify the execution of a particular message during the
message
flow since I don't see any context which can be modified for the
same. ?
I guess I'd need more details about what you are trying to do. The
Message contains a reference to the PhaseChain that is currently being
executed. From your interceptor, you can completely modify the chain
(for phases that have not yet run). You can add interceptors, delete
them, etc...
I hope that helps!
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog