Class ResponseStatusExceptionHandler
java.lang.Object
org.springframework.web.server.handler.ResponseStatusExceptionHandler
- All Implemented Interfaces:
WebExceptionHandler
- Direct Known Subclasses:
WebFluxResponseStatusExceptionHandler
Handle
ResponseStatusException
by setting the response status.
By default exception stack traces are not shown for successfully resolved
exceptions. Use setWarnLogCategory(String)
to enable logging with
stack traces.
- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Sebastien Deleuze
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
Determine the raw status code for the given exception.protected HttpStatus
Deprecated.reactor.core.publisher.Mono<Void>
handle
(ServerWebExchange exchange, Throwable ex) Handle the given exception.void
setWarnLogCategory
(String loggerName) Set the log category for warn logging.
-
Constructor Details
-
ResponseStatusExceptionHandler
public ResponseStatusExceptionHandler()
-
-
Method Details
-
setWarnLogCategory
Set the log category for warn logging.Default is no warn logging. Specify this setting to activate warn logging into a specific category.
- Since:
- 5.1
- See Also:
-
handle
Description copied from interface:WebExceptionHandler
Handle the given exception. A completion signal through the return value indicates error handling is complete while an error signal indicates the exception is still not handled.- Specified by:
handle
in interfaceWebExceptionHandler
- Parameters:
exchange
- the current exchangeex
- the exception to handle- Returns:
Mono<Void>
to indicate when exception handling is complete
-
determineStatus
Deprecated.as of 5.3 in favor ofdetermineRawStatusCode(Throwable)
.Determine the HTTP status for the given exception.As of 5.3 this method always returns
null
in which casedetermineRawStatusCode(Throwable)
is used instead.- Parameters:
ex
- the exception to check- Returns:
- the associated HTTP status, if any
-
determineRawStatusCode
Determine the raw status code for the given exception.- Parameters:
ex
- the exception to check- Returns:
- the associated HTTP status code, or -1 if it can't be derived.
- Since:
- 5.3
-
determineRawStatusCode(Throwable)
.