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

前端 未结 9 784
陌清茗
陌清茗 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:54

    This could be your answer: urlencoded Forward slash is breaking URL

    I would suggest not putting that in the path, move it to a request param instead.

    Work around:

    You could change the RequestMapping to

    @RequestMapping(value = "/ws/stuff/lookup/resourceId/**", method = RequestMethod.GET) 
    

    and then parse the path variables manually from the request object.

提交回复
热议问题