public class ResponseStatusExceptionHandler extends java.lang.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.
Modifier and Type | Field and Description |
---|---|
private static Log |
logger |
private Log |
warnLogger |
Constructor and Description |
---|
ResponseStatusExceptionHandler() |
Modifier and Type | Method and Description |
---|---|
protected HttpStatus |
determineStatus(java.lang.Throwable ex)
Determine the HTTP status implied by the given exception.
|
private java.lang.String |
formatError(java.lang.Throwable ex,
ServerHttpRequest request) |
<any> |
handle(ServerWebExchange exchange,
java.lang.Throwable ex)
Handle the given exception.
|
private HttpStatus |
resolveStatus(java.lang.Throwable ex) |
void |
setWarnLogCategory(java.lang.String loggerName)
Set the log category for warn logging.
|
public void setWarnLogCategory(java.lang.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 <any> handle(ServerWebExchange exchange, java.lang.Throwable ex)
WebExceptionHandler
handle
in interface WebExceptionHandler
exchange
- the current exchangeex
- the exception to handleMono<Void>
to indicate when exception handling is completeprivate java.lang.String formatError(java.lang.Throwable ex, ServerHttpRequest request)
@Nullable private HttpStatus resolveStatus(java.lang.Throwable ex)
@Nullable protected HttpStatus determineStatus(java.lang.Throwable ex)
ex
- the exception to introspect