Commit a56f35e5 authored by 王业雄's avatar 王业雄

test

parent 1ff69cf9
package com.quantgroup.asset.distribution.config; package com.quantgroup.asset.distribution.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
...@@ -16,6 +17,7 @@ import java.util.Set; ...@@ -16,6 +17,7 @@ import java.util.Set;
@Component @Component
@Order(Ordered.HIGHEST_PRECEDENCE) @Order(Ordered.HIGHEST_PRECEDENCE)
@Configuration @Configuration
@Slf4j
public class CrosFilter implements Filter { public class CrosFilter implements Filter {
private static final Set<String> DISALLOWED_METHOD = new HashSet<>(); private static final Set<String> DISALLOWED_METHOD = new HashSet<>();
...@@ -43,9 +45,11 @@ public class CrosFilter implements Filter { ...@@ -43,9 +45,11 @@ public class CrosFilter implements Filter {
String allowedHeaders = "Origin, No-Cache, x-auth-token, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type,Authorization"; String allowedHeaders = "Origin, No-Cache, x-auth-token, X-Requested-With, If-Modified-Since, Pragma, Last-Modified, Cache-Control, Expires, Content-Type,Authorization";
response.setHeader("Access-Control-Allow-Headers", allowedHeaders); response.setHeader("Access-Control-Allow-Headers", allowedHeaders);
response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Max-Age", "3600");
log.info("doFilter | 前端请求过滤,请求方法{}",request.getMethod());
if (DISALLOWED_METHOD.contains(request.getMethod())) { if (DISALLOWED_METHOD.contains(request.getMethod())) {
return; return;
} }
log.info("doFilter | 前端请求过滤,请求方法{}",request.getMethod());
filterChain.doFilter(servletRequest, servletResponse); filterChain.doFilter(servletRequest, servletResponse);
} }
......
package com.quantgroup.asset.distribution.config.web; package com.quantgroup.asset.distribution.config.web;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.CorsRegistry;
...@@ -14,6 +15,7 @@ import com.quantgroup.asset.distribution.config.web.interceptor.AuthorityInterce ...@@ -14,6 +15,7 @@ import com.quantgroup.asset.distribution.config.web.interceptor.AuthorityInterce
* *
*/ */
@Configuration @Configuration
@Slf4j
public class WebMvcConfigure extends WebMvcConfigurerAdapter { public class WebMvcConfigure extends WebMvcConfigurerAdapter {
@Autowired @Autowired
...@@ -30,6 +32,7 @@ public class WebMvcConfigure extends WebMvcConfigurerAdapter { ...@@ -30,6 +32,7 @@ public class WebMvcConfigure extends WebMvcConfigurerAdapter {
@Override @Override
public void addCorsMappings(CorsRegistry registry) { public void addCorsMappings(CorsRegistry registry) {
log.info("addCorsMappings | 前端请求过滤");
registry.addMapping("/**") registry.addMapping("/**")
.allowedOrigins("*") .allowedOrigins("*")
.allowedMethods("HEAD", "GET", "POST") .allowedMethods("HEAD", "GET", "POST")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment