tomcat高版本对url特殊参数值传递问题

springboot 后台接口:http://localhost:9031/update?mrId=2&name=刘天&status=0&person={“人事”:[1,2,3],“办公室”:[112,25,32]}&time&rId=1

person 传值到前台出现问题,高版本tomcat 对特殊参数值传递有限制。

1.修改 tomcat server.xml Connector

<Connector port="8084" protocol="HTTP/1.1" relaxedPathChars="[]|" relaxedQueryChars="<>[\\]^`{|}" useBodyEncodingForURI="true" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8"/>

2.加入

@Bean
  public TomcatServletWebServerFactory webServerFactory() {
     TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
     factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
              @Override
              public void customize(Connector connector) {
              	  // 设置可传递的符号
                  connector.setProperty("relaxedPathChars", "\"<>[\\]^`{|}");
                  connector.setProperty("relaxedQueryChars", "\"<>[\\]^`{|}");
               }
      });
      return factory;
  }

你可能感兴趣的:(web,java,tomcat)