您好,登錄后才能下訂單哦!
版本 -- cxf-2.5.2
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<!-- 引入cxf配置文件 -->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<!-- IP地址輸入攔截器 -->
<bean id="addressInInterceptor" class="com.webservice.impl.util.AddressInInterceptor" />
<!-- 全局攔截器Bus 也可以使用局部攔截器配置-->
<!--
<cxf:bus>
<cxf:inInterceptors>
<ref bean="addressInInterceptor" />
</cxf:inInterceptors>
</cxf:bus>
-->
<!-- 用戶信息-->
<bean id="userDetailsServiceImpl" class="com.webservice.impl.UserDetailsServiceImpl"/>
<jaxws:endpoint
id="userDetailsService"
implementor="#userDetailsServiceImpl"
implementorClass="com.webservice.impl.UserDetailsServiceImpl"
address="/userDetailsService" >
<jaxws:inInterceptors>
<ref bean="addressInInterceptor" />
</jaxws:inInterceptors>
</jaxws:endpoint>
</beans>
地址攔截 白名單
public class AddressInInterceptor extends AbstractPhaseInterceptor<Message> {
@Resource
com.hotent.platform.service.system.SysAcceptIpService sysAcceptIpService;
public AddressInInterceptor() {
super(Phase.RECEIVE);
}
/**
*攔截器過濾方法。
*/
public void handleMessage(Message message) throws Fault {
HttpServletRequest request = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
String ipAddr=request.getRemoteAddr();
if(!accept(ipAddr))
throw new Fault(new IllegalAccessException("ip地址" + ipAddr + " 拒絕訪問"));
}
}
訪問地址: http://ip:port/project/service/SystemResourcesService?wsdl
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。