版本 -- cxf-2.5.2
成都創(chuàng)新互聯(lián)公司專業(yè)提供成都主機(jī)托管四川主機(jī)托管成都服務(wù)器托管四川服務(wù)器托管,支持按月付款!我們的承諾:貴族品質(zhì)、平民價(jià)格,機(jī)房位于中國(guó)電信/網(wǎng)通/移動(dòng)機(jī)房,溫江服務(wù)器托管服務(wù)有保障!
<?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" />
<!-- 全局?jǐn)r截器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
網(wǎng)站名稱:springcxf配置
文章分享:http://jinyejixie.com/article20/iicsco.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供搜索引擎優(yōu)化、動(dòng)態(tài)網(wǎng)站、品牌網(wǎng)站建設(shè)、手機(jī)網(wǎng)站建設(shè)、響應(yīng)式網(wǎng)站、網(wǎng)站維護(hù)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)