Category: PathVariable

Spring @PathVariable mapping incomplete path when dots are included

In all my projects this happens at least once, and I'm surprised over and over again: a controller will not map just anything to @PathVariable by default. Contrary to intuition, the annotation's argument is a regular expression which excludes some characters per default. For instance the urlhttp://localhost:8080/myapp/api/user/testuser@example when mapped to a controller:@RequestMapping(value = "/api/user/{email}")ModelAndView findUserByEmail(@PathVariable("email") … Continue reading Spring @PathVariable mapping incomplete path when dots are included