From 01213c5d028b4592ecc29744e6a3863f4a605e34 Mon Sep 17 00:00:00 2001 From: chenkailing <632104866@qq.com> Date: Wed, 10 Feb 2021 12:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E9=92=88=E5=AF=B9=20tomcat?= =?UTF-8?q?=20=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/cn/keking/config/RFCConfig.java | 19 ------------------- .../main/java/cn/keking/config/WebConfig.java | 5 ++--- 2 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 server/src/main/java/cn/keking/config/RFCConfig.java diff --git a/server/src/main/java/cn/keking/config/RFCConfig.java b/server/src/main/java/cn/keking/config/RFCConfig.java deleted file mode 100644 index 63d69272..00000000 --- a/server/src/main/java/cn/keking/config/RFCConfig.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.keking.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * @author chenjh - * @since 2020/5/18 13:41 - */ -@Configuration -public class RFCConfig { - - @Bean - public Boolean setRequestTargetAllow() { - // RFC 7230,RFC 3986规范不允许url相关特殊字符,手动指定Tomcat url允许特殊符号, 如{}做入参,其他符号按需添加。见tomcat的HttpParser源码。 - System.setProperty("tomcat.util.http.parser.HttpParser.requestTargetAllow", "|{}"); - return true; - } -} diff --git a/server/src/main/java/cn/keking/config/WebConfig.java b/server/src/main/java/cn/keking/config/WebConfig.java index 9b19ad11..43a584f2 100644 --- a/server/src/main/java/cn/keking/config/WebConfig.java +++ b/server/src/main/java/cn/keking/config/WebConfig.java @@ -4,14 +4,14 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** * @author: chenjh * @since: 2019/4/16 20:04 */ @Configuration -public class WebConfig extends WebMvcConfigurerAdapter { +public class WebConfig implements WebMvcConfigurer { private final static Logger LOGGER = LoggerFactory.getLogger(WebConfig.class); /** @@ -22,6 +22,5 @@ public class WebConfig extends WebMvcConfigurerAdapter { String filePath = ConfigConstants.getFileDir(); LOGGER.info("Add resource locations: {}", filePath); registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/","classpath:/resources/","classpath:/static/","classpath:/public/","file:" + filePath); - super.addResourceHandlers(registry); } }