SpringBoot 请求参数包含 [] 特殊符号 返回400状态 #1795

pull/1967/head
tank99tank 4 years ago
parent 3b4a65ba04
commit 94c0610496

@ -2,11 +2,13 @@ package org.jeecg;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.Context; import org.apache.catalina.Context;
import org.apache.catalina.connector.Connector;
import org.apache.tomcat.util.scan.StandardJarScanner; import org.apache.tomcat.util.scan.StandardJarScanner;
import org.jeecg.common.util.oConvertUtils; import org.jeecg.common.util.oConvertUtils;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
@ -48,11 +50,22 @@ public class JeecgSystemApplication extends SpringBootServletInitializer {
*/ */
@Bean @Bean
public TomcatServletWebServerFactory tomcatFactory() { public TomcatServletWebServerFactory tomcatFactory() {
return new TomcatServletWebServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(){
@Override @Override
protected void postProcessContext(Context context) { protected void postProcessContext(Context context) {
((StandardJarScanner) context.getJarScanner()).setScanManifest(false); ((StandardJarScanner) context.getJarScanner()).setScanManifest(false);
} }
}; };
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
@Override
public void customize(Connector connector) {
connector.setProperty("relaxedPathChars", "\"<>[\\]^`{|}");
connector.setProperty("relaxedQueryChars", "\"<>[\\]^`{|}");
}
});
return factory;
} }
} }
Loading…
Cancel
Save