package com.gosophia.metadataEngine.webservice.interceptor;
import javax.xml.ws.WebServiceException;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*继承一个拦截器类
*/
public class ErrorInterceptor extends AbstractPhaseInterceptor<Message>{
public ErrorInterceptor(String phase) {
super(phase);
}
public ErrorInterceptor(){
super(Phase.RECEIVE);
}
public void handleMessage(Message arg0) throws Fault {
}
//出现错误输出错误信息和栈信息
public void handleFault(Message message) {
Logger logger = LoggerFactory.getLogger(getClass());
Exception exeption=message.getContent(Exception.class);
logger.error(exeption.getMessage(),exeption);
}
}
配置拦截器
<jaxws:endpoint id="dataViewWebServiceEP" address="/DataViewWebService">
<jaxws:implementor ref="dataViewWebService" />
<jaxws:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
<bean class="com.gosophia.metadataEngine.webservice.interceptor.ErrorInterceptor"></bean>
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<!-- 输出日志 -->
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean>
</jaxws:outInterceptors>
</jaxws:endpoint>
分享到:
相关推荐
CXF3.0 Spring3.2 自定义拦截器
11.为CXF客户端添加自定义拦截器完成权限控制
10.为CXF服务器端添加自定义拦截器进行权限检查
spring4+cxf3,因为自己项目要用到接口开发,所以综合现有网上所有教程,终于成功写出能自动注入的demo,这个是含拦截器
CXF 自定义拦截器实现的 webservice安全机制实例工程, 带jar包 ,代码注释详细 内有说明文档, 由于资源过大 ,所以客户端jar包 删除掉了, 只需要把服务端的jar 拷贝到 客户端即可 , 小弟刚刚研究完 CXF 安全 。...
这里少了一个类,是根据实体类生成xml的文件下载地址为:http://download.csdn.net/detail/qq_14996421/9495688
注册自定义拦截器,添加拦截路径和排除拦截路径WebAppConfig
CXF+Spring+自定义拦截器 webservice源码下载
CXF使用EndpointImpl发布WebService加入拦截器
实现了客户端和服务端,客户端添加header服务端获取验证!
讲解了cxf实现拦截器的原因、核心API及使用方法
08.CXF拦截器的理论以及如何为CXF的客户端和服务器端添加拦截器
Web Service学习-CXF开发Web Service的权限控制(二)
用于使用CXF打印SOAP报文,记录WebService日志~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CXF发布WebService加入拦截器
ssh2-interceptor拦截器(权限管理).
CXF spring 提供rest服务输出xml或json等格式数据
13.为CXF与Spring整合发布WebService添加拦截器进行权限控制
基于cxf webservice的加密,项目代码只是一个demo,有问题的可以加我
webservice拦截器demo-服务端和调用端