After struggling a while to find the most correct way of returning HTTP status 204 from a REST controller I finally find the solution – which of-course is very simple.
Just add the @ResponseStatus annotation to your resource let the method return void.
1 2 3 4 |
@RequestMapping(method = RequestMethod.GET) @ResponseStatus(HttpStatus.NO_CONTENT) public void foo() { } |