| SETUP | Any set up for the following phases(设置阶段) |
| (PRE/USER/POST)_LOGICAL | Processing of objects about to marshalled |
| PREPARE_SEND | Opening of the connection(消息发送准备阶段,在该阶段创建Connection) |
| PRE_STREAM | 流准备阶段 |
| PRE_PROTOCOL | Misc protocol actions(协议准备阶段) |
| WRITE | Writing of the protocol message, such as the SOAP Envelope.(写消息阶段) |
| MARSHAL | Marshalling of the objects |
| (USER/POST)_PROTOCOL | Processing of the protocol message |
| (USER/POST)_STREAM | Processing of the byte level message(字节处理阶段,在该阶段把消息转为字节) |
| SEND | 消息发送 |
在CXF中,所有对消息的处理都是通过各种拦截器实现。CXF已经实现了多种拦截器,如操纵消息头、执行认证检查、验证消息数据、日志记录、消息压缩等,有些拦截器在发布服务、访问服务时已经默认添加到拦截器链。
日志拦截器
CXF已经内置了一些拦截器,这些拦截器大部分默认添加到拦截器链中,有些需要手动添加,如CXF提供的日志拦截器:输入日志拦截器LoggingInInterceptor和输出日志拦截器LoggingOutInterceptor,可以用在服务端也可以用在客户端,用来在测试或调试的时候输出服务端、客户端请求和接收到的信息。
服务端配置方式如下:
<jaxrs:server id=“restServiceContainer” address="/cxf">
jaxrs:inInterceptors
</jaxrs:inInterceptors>
jaxrs:outInterceptors
</jaxrs:outInterceptors>
jaxrs:serviceBeans
</jaxrs:serviceBeans>
</jaxrs:server>