优化tomcat配置relaxedQueryChars方式,采用TomcatConnectorCustomizer来实现 (#764)

* Create RelaxedQueryCharsConnectorCustomizer

* delete tomcat relaxedQueryChars code

* 优化tomcat配置relaxedQueryChars方式
pull/725/head^2
bearBoy80 2022-10-24 18:03:17 +08:00 committed by GitHub
parent 7a7fb53ea7
commit a330519f6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View File

@ -56,13 +56,6 @@ public class AppRun {
return new SpringContextHolder();
}
@Bean
public ServletWebServerFactory webServerFactory() {
TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory();
fa.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "[]{}"));
return fa;
}
/**
* 访
*

View File

@ -0,0 +1,16 @@
package me.zhengjie.config;
import org.apache.catalina.connector.Connector;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.context.annotation.Configuration;
/**
* @author bearBoy80
*/
@Configuration(proxyBeanMethods = false)
public class RelaxedQueryCharsConnectorCustomizer implements TomcatConnectorCustomizer {
@Override
public void customize(Connector connector) {
connector.setProperty("relaxedQueryChars", "[]{}");
}
}