You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Wulff, Oliver" <Ol...@iona.com> on 2008/09/29 15:47:54 UTC
Interceptor: How to verify the current context (inbound/outbound and request/response)
Hi there
I can check whether handleMessage is called in the context of inbound or outbound with the following lines:
boolean isOutbound = message == message.getExchange().getOutMessage()
|| message == message.getExchange().getOutFaultMessage();
But how can I check whether it's outbound in the context before the request is sent or a response is sent?
Thanks
Oliver
AW: Interceptor: How to verify the current context (inbound/outbound and request/response)
Posted by "Wulff, Oliver" <Ol...@iona.com>.
Hi Eoghan
I was exactly looking for that.
Thanks
Oli
-----Ursprüngliche Nachricht-----
Von: Eoghan Glynn [mailto:eoghan.glynn@iona.com]
Gesendet: Mo 29.09.2008 15:59
An: users@cxf.apache.org
Betreff: Re: Interceptor: How to verify the current context (inbound/outbound and request/response)
Oli,
The outMessage in this case is the outbound message currently being
marshalled up *before* being sent. So your code will work before the
request/response is sent.
For example on the client-side, ClientImpl.invoke() delegates to the
binding to create the outMessage and sets this on the Exchange before
traversing the intercpetor chain.
In fact, this sort of test is pretty much the approach used by the WS-A
code to determine message direction (with a little added defensiveness
against NPEs). See ContextUtils.isOutbound():
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?view=co
/Eoghan
Wulff, Oliver wrote:
> Hi there
>
> I can check whether handleMessage is called in the context of inbound or outbound with the following lines:
>
> boolean isOutbound = message == message.getExchange().getOutMessage()
> || message == message.getExchange().getOutFaultMessage();
>
> But how can I check whether it's outbound in the context before the request is sent or a response is sent?
>
> Thanks
> Oliver
>
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland
Re: Interceptor: How to verify the current context (inbound/outbound
and request/response)
Posted by Eoghan Glynn <eo...@iona.com>.
Oli,
The outMessage in this case is the outbound message currently being
marshalled up *before* being sent. So your code will work before the
request/response is sent.
For example on the client-side, ClientImpl.invoke() delegates to the
binding to create the outMessage and sets this on the Exchange before
traversing the intercpetor chain.
In fact, this sort of test is pretty much the approach used by the WS-A
code to determine message direction (with a little added defensiveness
against NPEs). See ContextUtils.isOutbound():
http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?view=co
/Eoghan
Wulff, Oliver wrote:
> Hi there
>
> I can check whether handleMessage is called in the context of inbound or outbound with the following lines:
>
> boolean isOutbound = message == message.getExchange().getOutMessage()
> || message == message.getExchange().getOutFaultMessage();
>
> But how can I check whether it's outbound in the context before the request is sent or a response is sent?
>
> Thanks
> Oliver
>
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland