public class ResponseStatusExceptionHandler extends Object implements WebExceptionHandler
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.
Constructor and Description |
---|
ResponseStatusExceptionHandler() |
Modifier and Type | Method and Description |
---|---|
protected int |
determineRawStatusCode(Throwable ex)
Determine the raw status code for the given exception.
|
protected HttpStatus |
determineStatus(Throwable ex)
Deprecated.
as of 5.3 in favor of
determineRawStatusCode(Throwable) . |
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.
|
public void setWarnLogCategory(String loggerName)
Default is no warn logging. Specify this setting to activate warn logging into a specific category.
LogFactory.getLog(String)
,
Logger.getLogger(String)
public reactor.core.publisher.Mono<Void> handle(ServerWebExchange exchange, Throwable ex)
WebExceptionHandler
handle
in interface WebExceptionHandler
exchange
- the current exchangeex
- the exception to handleMono<Void>
to indicate when exception handling is complete@Nullable @Deprecated protected HttpStatus determineStatus(Throwable ex)
determineRawStatusCode(Throwable)
.As of 5.3 this method always returns null
in which case
determineRawStatusCode(Throwable)
is used instead.
ex
- the exception to checkprotected int determineRawStatusCode(Throwable ex)
ex
- the exception to check