How do I get a Spring 3.0 controller to trigger a 404?
I have a controller with @RequestMapping(value = \"/**\", method = RequestMethod.GET) and for som
I'd recommend throwing HttpClientErrorException, like this
@RequestMapping(value = "/sample/")
public void sample() {
if (somethingIsWrong()) {
throw new HttpClientErrorException(HttpStatus.NOT_FOUND);
}
}
You must remember that this can be done only before anything is written to servlet output stream.