spring-framework / org.springframework.web.servlet.handler / SimpleMappingExceptionResolver / setDefaultStatusCode

setDefaultStatusCode

open fun setDefaultStatusCode(defaultStatusCode: Int): Unit

Set the default HTTP status code that this exception resolver will apply if it resolves an error view and if there is no status code mapping defined.

Note that this error code will only get applied in case of a top-level request. It will not be set for an include request, since the HTTP status cannot be modified from within an include.

If not specified, no status code will be applied, either leaving this to the controller or view, or keeping the servlet engine's default of 200 (OK).

Parameters

defaultStatusCode - HTTP status code value, for example 500 (HttpServletResponse#SC_INTERNAL_SERVER_ERROR) or 404 (HttpServletResponse#SC_NOT_FOUND)

See Also
#setStatusCodes(Properties)