移除针对 tomcat 的配置

pull/22/head
chenkailing 2021-02-10 12:53:27 +08:00
parent 49685e545b
commit 01213c5d02
2 changed files with 2 additions and 22 deletions

View File

@ -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 7230RFC 3986规范不允许url相关特殊字符手动指定Tomcat url允许特殊符号 如{}做入参其他符号按需添加。见tomcat的HttpParser源码。
System.setProperty("tomcat.util.http.parser.HttpParser.requestTargetAllow", "|{}");
return true;
}
}

View File

@ -4,14 +4,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 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 * @author: chenjh
* @since: 2019/4/16 20:04 * @since: 2019/4/16 20:04
*/ */
@Configuration @Configuration
public class WebConfig extends WebMvcConfigurerAdapter { public class WebConfig implements WebMvcConfigurer {
private final static Logger LOGGER = LoggerFactory.getLogger(WebConfig.class); private final static Logger LOGGER = LoggerFactory.getLogger(WebConfig.class);
/** /**
@ -22,6 +22,5 @@ public class WebConfig extends WebMvcConfigurerAdapter {
String filePath = ConfigConstants.getFileDir(); String filePath = ConfigConstants.getFileDir();
LOGGER.info("Add resource locations: {}", filePath); LOGGER.info("Add resource locations: {}", filePath);
registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/","classpath:/resources/","classpath:/static/","classpath:/public/","file:" + filePath); registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/","classpath:/resources/","classpath:/static/","classpath:/public/","file:" + filePath);
super.addResourceHandlers(registry);
} }
} }