`
zsjg13
  • 浏览: 137984 次
  • 性别: Icon_minigender_1
  • 来自: 安徽
社区版块
存档分类
最新评论

Messaging and Interceptors

    博客分类:
  • CXF
阅读更多

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.

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics