码迷,mamicode.com
首页 > 其他好文 > 详细

跨域访问

时间:2017-09-12 12:18:18      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:url   ppi   ini   访问   control   依赖   pom   技术分享   accept   

1.web.xml中

 

<filter>
<filter-name>CORS Filter</filter-name>
<filter-class>org.ebaysf.web.cors.CORSFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
<param-value>GET,POST,HEAD,OPTIONS,PUT</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.headers</param-name>
<param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CORS Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

 

 

2.pom文件添加依赖

 <dependency>
<groupId>org.ebaysf.web</groupId>
<artifactId>cors-filter</artifactId>
<version>1.0.1<技术分享/version>
</dependency>

 

跨域访问

标签:url   ppi   ini   访问   control   依赖   pom   技术分享   accept   

原文地址:http://www.cnblogs.com/ximencuixue/p/7509089.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!