Messaging and Interceptors

Messaging and Interceptors

One of the important elements of CXF architecture is the Interceptor components. 

Interceptors are components that intercept the messages exchanged or passed 

between web service clients and server components. In CXF, this is implemented 

through the concept of Interceptor chains. The concept of Interceptor chaining is  

the core functionality of CXF runtime. 

 

The interceptors act on the messages which are sent and received from the web 

service and are processed in chains. Each interceptor in a chain is configurable, and 

the user has the ability to control its execution. 

 

The core of the framework is the Interceptor interface. It defines two abstract 

methods—handleMessage and handleFault. Each of the methods takes the object 

of type Message as a parameter. A developer implements the handleMessage to 

process or act upon the message. The handleFault method is implemented to 

handle the error condition. Interceptors are usually processed in chains with every 

interceptor in the chain performing some processing on the message in sequence, 

and the chain moves forward. Whenever an error condition arises, a handleFault 

method is invoked on each interceptor, and the chain unwinds or moves backwards.

 

Interceptors are often organized or grouped into phases. Interceptors providing 

common functionality can be grouped into one phase. Each phase performs specific 

message processing. Each phase is then added to the interceptor chain. The chain, 

therefore, is a list of ordered interceptor phases. The chain can be created for both 

inbound and outbound messages. A typical web service endpoint will have three 

interceptor chains:

• Inbound messages chain

• Outbound messages chain

• Error messages chain

There are built-in interceptors such as logging, security, and so on, and the 

developers can also choose to create custom interceptors.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值