Encoded slash (/) with Spring RequestMapping path param gives HTTP 400

前端 未结 9 775
陌清茗
陌清茗 2020-12-05 00:10

This is not a duplicate referenced question, because it is Spring specific. Whoever added that (3 years after the fact!) didn\'t bother to read the question or comment

9条回答
  •  遥遥无期
    2020-12-05 00:32

    The following resolved the BACK_SLASH issue:

    public static void main(String[] args) throws Exception {
      System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true");
      SpringApplication.run(Application.class, args);
    }
    

    But, same functionality could be done via application.yml.

    org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH: true
    

    This setting doesn't work. I did not find a way for that, and still looking at it.

提交回复
热议问题