I have this Controller
@Controller
@RequestMapping(value = "/v1.0/user")
public class UserController {
@RequestMapping(value = "/findOne/{id}", method = RequestMethod.GET)
public @ResponseBody String findOne(@PathVariable("id") Integer id) {
log.info("findOne");
return "found URL";
}
}
Which will match the URL: http://localhost:8080/v1.0/user/findOne/4
But if my path varibale is not correct: http://localhost:8080/v1.0/user/findOne/4A
The I get nothing. Not even an error. It's as if Spring swallowed the URL.
I added
@RequestMapping(value = "/.*", method = RequestMethod.GET)
public @ResponseBody String redirectEverythingOtherThanTest(){
log.info("no url matched");
return "badly formed URL for Users";
}
Again I get nothing. What I'm trying to accomplish is for each Controller to have a unique message when the URL does not match.