-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Christopher Smith opened SPR-13560 and commented
I am supporting resource deletion under certain circumstances, but semantic preconditions (referential integrity) must be enforced, and if they aren't, I want to return a 422. This is fairly simple in a REST controller, but in an HTML controller, I want to send the user an HTML page describing the condition, along with the 422 status code.
I can programmatically set the status code for a REST response with a ResponseEntity, and I can statically set the status code for an HTML response with @ResponseStatus, but there's no mechanism for programmatically setting the status code when using a ModelAndView. I would like a status field on ModelAndView that I can set based on controller logic.
Affects: 4.2.1
Issue Links:
- ModelAndView's setStatus does not work for @ExceptionHandler methods [SPR-14796] #19362 ModelAndView's setStatus does not work for
@ExceptionHandlermethods
1 votes, 4 watchers