原因是一个完整的请求地址包含 http(s)://xxxx/xxx/xxx url里面包含tomcat鬼定字符以外的字符,他们不被认可为合理的url参数,必须满足RFC 3986规范
/** * 解决 servlet 字符串乱码 * * @return ConfigurableServletWebServerFactory */ @Bean @Profile({"common", "prod", "local"}) public TomcatServletWebServerFactory webServerFactory() { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(); factory.addConnectorCustomizers((Connector connector) -> { connector.setProperty("relaxedPathChars", "\"<>[\\]^`{|}"); }); return factory; }
tips:tomcat7(包含)以下没有次问题
标签:TomcatServletWebServerFactory,return,包含,url,factory,connector,400,特殊字符 From: https://www.cnblogs.com/wangbiaohistory/p/17474874.html