2

While I was modifying the code written by other developer I come across an end point @RequestMapping(value = "/ICD/{icdcode:.+} and wanted to know what is :.+ in the path variable.

user09
  • 920
  • 2
  • 12
  • 38

1 Answers1

3

This has already been answered

Spring MVC @PathVariable getting truncated

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

Spring - Path variable truncate after dot - annotation

Basically, it is a regular expression. Spring considers that anything behind the last dot is an extension and get rid of it.

If you have a mapping to /somepath/{email} and try /somepath/test@gmail.com the value for the path parameter email will be test@gmail

Using the regular expression {pathparam:.+} everything is considered part of the value, even what is behind the last dot.

Community
  • 1
  • 1
alfcope
  • 2,327
  • 2
  • 13
  • 21
  • Thanks for clarification. It would have been answered but when I search exactly with the key words I didn't find any matching answers. – user09 Feb 17 '17 at 15:47