I have several SprigMVC methods as shown below, returning either a ModelAndView or a Responsebody. When users make a request to these URLs that do not have the required parameters, they naturally receive the message "The required parameter for the string" id "is missing . "
From a security point of view, I want to hide these detailed messages from users. Thus, the hacker does not easily know the missing parameters and will receive a 400 error without any description. Is this possible using the spring / Spring Security configuration, or will I have to manually reorganize all my methods in order to somehow return a custom message.
@RequestMapping(value = "/payment", method = RequestMethod.GET)
public ModelAndView getReponse(@RequestParam(value = "id", required = true)) {
return model;
}
@RequestMapping(value = "/status", method = RequestMethod.GET)
public @ResponseBody String getStatus(@RequestParam(value = "id", required = true) String id) {
return "string";
}