简体   繁体   English

是否可以在多个阶段中注册CXF拦截器?

[英]Is it possible to register a CXF Interceptor in more than one Phases?

I have a CXF Rest Service and I am trying to create a logging mechanism that will log specific request and response details. 我有一个CXF Rest Service ,我正在尝试创建一个日志记录机制,该机制将记录特定的requestresponse详细信息。

All the details I want to be written into a file in one write. 我想一次写入所有细节。 As a result I am looking forward to create an Interceptor that will be invoked in the RECEIVE and in the SEND phase. 因此,我期待创建一个将在RECEIVESEND阶段调用的Interceptor Until now I haven't find any way to do it. 到目前为止,我还没有找到任何方法。

Is it possible to create an Interceptor registered in two phases of two different chains? 是否可以创建在两个不同链的两个阶段中注册的拦截器?

Thanks 谢谢

Just got an answer from the cxf-user mailing lists which is 刚刚从cxf-用户邮件列表中得到了答案

It's not possible to register the exact same interceptor object in two phases. 分两个阶段无法注册完全相同的拦截器对象。 You can register two separate interceptors of the same class on different phases, but not the same exact object. 您可以在不同的阶段注册两个相同类的单独的拦截器,但不能注册完全相同的对象。 The phase needs to be set at construction time. 需要在施工时设置阶段。

Daniel Kulp 丹尼尔·库尔普(Daniel Kulp)

So the answer is No. 所以答案是否定的。

link to post 链接到帖子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM