您可以使用自定义日志拦截器来处理邮件。
public class CustLogInInterceptor extends AbstractSoapInterceptor {
public CustLogInInterceptor() {
super(Phase.RECEIVE);
}
@Override
public void handleMessage(SoapMessage message) throws Fault {
HttpServletRequest httpRequest = (HttpServletRequest) message.get (AbstractHTTPDestination.HTTP_REQUEST);
LoggerUtil.setLog(CustLogInInterceptor.class , LogConstants.DEBUG, "Request From the address : " + httpRequest.getRemoteAddr ());
try
{
//Handle you custom code add log it
LoggerUtil.setLog(CustLogInInterceptor.class , LogConstants.DEBUG, "Log here");
}
catch (Exception ex)
{
ex.printStackTrace ();
}
}
}
您的CXF配置会是什么样子像下面
<jaxws:endpoint>
<jaxws:inInterceptors>
<ref bean="custInterceptor"/>
</jaxws:inInterceptors>
</jaxws:endpoint>
<bean id="custInterceptor" class="com.kp.CustLogInInterceptor">
以下是过滤的完整实现:https://github.com/greenbird/xml-formatter-components/tree/master/cxf – ThomasRS