tomcat服务器跨域设置

应用于java的web项目

首先需要导入两个包cors-filter 2.4 , java-property-utils 1.9.1
  
    com.thetransactioncompany  
    cors-filter  
    2.4  
  
  
    com.thetransactioncompany  
    java-property-utils  
    1.9.1  
 

之后在web.xml中配置filter
    
    CORS    
    com.thetransactioncompany.cors.CORSFilter    
        
        cors.allowOrigin    
        *    
        
        
         cors.supportedMethods    
        GET, POST, HEAD, PUT, DELETE    
        
        
        cors.supportedHeaders    
        Accept, Origin, X-Requested-With, Content-Type, Last-Modified    
        
        
        cors.exposedHeaders    
        Set-Cookie    
        
        
        cors.supportsCredentials    
        true    
        
    
    
    CORS    
    /*    



服务器可以跨域

你可能感兴趣的:(java开发)