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

前端 未结 9 780
陌清茗
陌清茗 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条回答
  •  萌比男神i
    2020-12-05 00:45

    Another answer would be to encode "/" twice, which would produce "%252F".
    In your mapped endpoint, Spring will decode it back to "%2F". All you need more is to decode it one more time using something like this:

    URLDecoder.decode(encoded_URL, "UTF-8");

提交回复
热议问题