I'm implementing an interceptor for CXF and am looking for a way to 
programmatically determine where the interceptor is actually being 
called during processing, i.e. I want to know whether the interceptor is 
being run on the client or the service side and in the outgoing or 
incoming interceptor chain. Outgoing or incoming chain is easy:

message.get(MESSAGE_INFO_KEY).getType() returns Type.INPUT or Type.OUTPUT

To determine if I am on the client or service side I came up with 
something like this (pseudocode):

((type == Type.INPUT) && (message == 
message.getExchange().getOutMessage())) => Client / Request
((type == Type.INPUT) && (message == 
message.getExchange().getInMessage())) => Provider / Request
((type == Type.OUTPUT) && (message == 
message.getExchange().getOutMessage())) => Provider / Response
((type == Type.OUTPUT) && (message == 
message.getExchange().getInMessage())) => Client / Response

Did I get this right? Is there maybe a more elegant way to handle this?

Thanks in advance for any hints.

Best regards

     Jerry

Reply via email to