Spring MVC @PathVariable with dot (.) is getting truncated

后端 未结 17 1314
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 06:00

This is continuation of question Spring MVC @PathVariable getting truncated

Spring forum states that it has fixed(3.2 version) as part of ContentNegotiationManager.

17条回答
  •  终归单人心
    2020-11-22 06:43

    In addition to Martin Frey's answer, this can also be fixed by adding a trailing slash in the RequestMapping value:

    /path/{variable}/
    

    Keep in mind that this fix does not support maintainability. It now requires all URI's to have a trailing slash - something that may not be apparent to API users / new developers. Because it's likely not all parameters may have a . in them, it may also create intermittent bugs

提交回复
热议问题