Top Description Inners Fields Constructors Methods
org.springframework.web.server.handler

public Class ExceptionHandlingWebHandler

extends WebHandlerDecorator
Class Inheritance
Imports
java.util.ArrayList, .Collections, .List, reactor.core.publisher.Mono, org.springframework.http.HttpMethod, org.springframework.http.server.reactive.ServerHttpRequest, org.springframework.util.StringUtils, org.springframework.web.server.ServerWebExchange, .WebExceptionHandler, .WebHandler

WebHandler decorator that invokes one or more WebExceptionHandlers after the delegate WebHandler.
Author
Rossen Stoyanchev
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
ExceptionHandlingWebHandler.CheckpointInsertingHandler

WebExceptionHandler to insert a checkpoint with current URL information.

Field Summary

Modifier and TypeField and Description
private final List<WebExceptionHandler>
public static final String
HANDLED_WEB_EXCEPTION

Name of the attribute that contains the exception handled by WebExceptionHandlers.

Constructor Summary

AccessConstructor and Description
public
ExceptionHandlingWebHandler(WebHandler
the WebHandler delegate
delegate
,
List<WebExceptionHandler>
the WebExceptionHandlers to apply
handlers
)

Create an ExceptionHandlingWebHandler for the given delegate.

Method Summary

Modifier and TypeMethod and Description
public List<WebExceptionHandler>
getExceptionHandlers()

Return a read-only list of the configured exception handlers.

public Mono<Void>
handle(ServerWebExchange
the current server exchange
exchange
)

Overrides org.springframework.web.server.handler.WebHandlerDecorator.handle.

Implements org.springframework.web.server.WebHandler.handle.

Handle the web server exchange.

Inherited from org.springframework.web.server.handler.WebHandlerDecorator:
getDelegatetoString

Field Detail

exceptionHandlersback to summary
private final List<WebExceptionHandler> exceptionHandlers
HANDLED_WEB_EXCEPTIONback to summary
public static final String HANDLED_WEB_EXCEPTION

Name of the attribute that contains the exception handled by WebExceptionHandlers.

Since
6.1

Constructor Detail

ExceptionHandlingWebHandlerback to summary
public ExceptionHandlingWebHandler(WebHandler delegate, List<WebExceptionHandler> handlers)

Create an ExceptionHandlingWebHandler for the given delegate.

Parameters
delegate:WebHandler

the WebHandler delegate

handlers:List<WebExceptionHandler>

the WebExceptionHandlers to apply

Method Detail

getExceptionHandlersback to summary
public List<WebExceptionHandler> getExceptionHandlers()

Return a read-only list of the configured exception handlers.

handleback to summary
public Mono<Void> handle(ServerWebExchange exchange)

Overrides org.springframework.web.server.handler.WebHandlerDecorator.handle.

Implements org.springframework.web.server.WebHandler.handle.

Doc from org.springframework.web.server.WebHandler.handle.

Handle the web server exchange.

Parameters
exchange:ServerWebExchange

the current server exchange

Returns:Mono<Void>

Mono<Void> to indicate when request handling is complete

Annotations
@Override
org.springframework.web.server.handler back to summary

private Class ExceptionHandlingWebHandler.CheckpointInsertingHandler

extends Object
implements WebExceptionHandler
Class Inheritance
  • java.lang.Object
  • org.springframework.web.server.handler.ExceptionHandlingWebHandler.CheckpointInsertingHandler
All Implemented Interfaces
org.springframework.web.server.WebExceptionHandler

WebExceptionHandler to insert a checkpoint with current URL information. Must be the first in order to ensure we catch the error signal before the exception is handled and e.g. turned into an error response.
Since
5.2

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public Mono<Void>
handle(ServerWebExchange
the current exchange
exchange
,
Throwable
the exception to handle
ex
)

Implements org.springframework.web.server.WebExceptionHandler.handle.

Handle the given exception.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CheckpointInsertingHandlerback to summary
private CheckpointInsertingHandler()

Method Detail

handleback to summary
public Mono<Void> handle(ServerWebExchange exchange, Throwable ex)

Implements org.springframework.web.server.WebExceptionHandler.handle.

Doc from org.springframework.web.server.WebExceptionHandler.handle.

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.

Parameters
exchange:ServerWebExchange

the current exchange

ex:Throwable

the exception to handle

Returns:Mono<Void>

Mono<Void> to indicate when exception handling is complete

Annotations
@Override