Spring @PathVariable mapping incomplete path when dots are included
http://localhost:8080/myapp/api/user/testuser@example.com
when mapped to a controller:
@RequestMapping(value = "/getProxyUserDetails/{email}")
ModelAndView findUserByEmail(@PathVariable("email") String email){
// email = testuser@example
}
will result in "testuser@example" ... missing the ".com" suffix.The correct mapping is:
@RequestMapping(value = "/getProxyUserDetails/{email:.*}")
ModelAndView findUserByEmail(@PathVariable("email") String email){
// email = testuser@example.com
}
No comments:
Post a Comment