Throwing the ResponseStatusException too late during the request processing causes the response body to be partially committed and not displaying the customized error page.
Use a ServerHttpResponseDecorator that throws the exception as soon as its setStatusCode() method is called.
Throwing the
ResponseStatusException
too late during the request processing causes the response body to be partially committed and not displaying the customized error page.Use a
ServerHttpResponseDecorator
that throws the exception as soon as itssetStatusCode()
method is called.