tomcat特殊字符处理问题解决方案
- 直接加上如下代码,本质是通过反射加上过滤字符
@Configuration
public class TomcatConfig {
@Bean
public ConfigurableServletWebServerFactory webServerFactory() {
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
factory.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
//允许的特殊字符
connector.setProperty("relaxedQueryChars", "|{}[]");
});
return factory;
}
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/17201.html