I am trying to build a request filter that will only get used if it matches a pattern of the letter e, then a number. However I cannot seem to get it to work. I keep gettin
You should use:
@RequestMapping("/e{number:\\d+})
Notice the "escaped slash" before the \d
digit specifier.
According to the documentation, you have to use something like {varName:regex}
. There's even an example :
@RequestMapping("/spring-web/{symbolicName:[a-z-]+}-{version:\\d\\.\\d\\.\\d}{extension:\\.[a-z]+}")
public void handle(@PathVariable String version, @PathVariable String extension) {
// ...
}
}