zoukankan      html  css  js  c++  java
  • Java项目服务器跨域设置

    引入jar包

    cors-filter-2.6 :http://central.maven.org/maven2/com/thetransactioncompany/cors-filter/2.6/cors-filter-2.6.jar

    java-property-utils-1.9.1 :http://central.maven.org/maven2/com/thetransactioncompany/java-property-utils/1.9.1/java-property-utils-1.9.1.jar


    在web.xml加入下面过滤器代码
     

    <filter> <filter-name>CORS</filter-name> <filter-class>com.thetransactioncompany.cors.CORSFilter</filter-class> <init-param> <param-name>cors.allowOrigin</param-name> <param-value>*</param-value> </init-param> <init-param> <param-name>cors.supportedMethods</param-name> <param-value>GET, POST</param-value> </init-param> <init-param> <param-name>cors.supportedHeaders</param-name> <param-value>Accept, Origin, X-Requested-With, Content-Type, Last-Modified</param-value> </init-param> <init-param> <param-name>cors.exposedHeaders</param-name> <param-value>Set-Cookie</param-value> </init-param> <init-param> <param-name>cors.supportsCredentials</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>CORS</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
  • 相关阅读:
    SQL语句熟悉
    CSS3 attribute
    轮播器
    PHP 邮箱操作的Action
    Hole puncher Show Picture
    力扣算法——133.CloneGraph【M】
    力扣算法——134GasStation【M】
    力扣算法——135Candy【H】
    力扣算法——136SingleNumber【E】
    力扣算法——137SingleNumberII【M】
  • 原文地址:https://www.cnblogs.com/incognitor/p/11024909.html
Copyright © 2011-2022 走看看