Jimmy小站
小明也有大梦想 — 蒋明/铭想到什么记什么 后续整理
2021-04-11 / 未分类 / 3607 次围观 / 0 次吐槽hazelcast 分布式工具
binlog undo log redo log理解
https://juejin.cn/post/7103539389644406798
mvnDebug clean install 编译器调试
远程连接debug
更换openwrt 镜像源为清华的
sed -i ‘s_downloads.openwrt.org_mirrors.tuna.tsinghua.edu.cn/openwrt_’ /etc/opkg/distfeeds.conf
spring preflight 401 403跨域
package org.jeecg;
import org.apache.http.HttpStatus;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Configuration
public class CorsFilterConfig {
@Bean
public FilterRegistrationBean<Filter> corsFilter() {
FilterRegistrationBean<Filter> registrationBean = new FilterRegistrationBean<>();
registrationBean.setFilter((servletRequest, servletResponse, filterChain) -> {
HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
//指定允许其他域名访问
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS");
response.setHeader("Access-Control-Max-Age", "86400");
response.setHeader("Access-Control-Allow-Headers", "*");
if ("OPTIONS".equals(httpServletRequest.getMethod())) {
response.setStatus(HttpStatus.SC_OK);
}
filterChain.doFilter(servletRequest, servletResponse);
});
//过滤器名称
registrationBean.setName("corsFilter");
//拦截规则
registrationBean.addUrlPatterns("/*");
//过滤器顺序
registrationBean.setOrder(FilterRegistrationBean.HIGHEST_PRECEDENCE);
return registrationBean;
}
}
推荐您阅读更多有关于“”的文章
- 凝汽器化学清洗(高压水射流清洗)
本月热文
Copyright © Jimmy小站 Allrights Reserved.备案号:桂ICP备 15005996
额 本文暂时没人评论 来添加一个吧
发表评论