public class WebHttpHandlerBuilder extends Object
One is to assemble a processing chain that consists of a target
WebHandler, then decorated with a set of WebFilter's, then
further decorated with a set of WebExceptionHandler's.
The second purpose is to adapt the resulting processing chain to an
HttpHandler -- the lowest level reactive HTTP handling abstraction,
which can then be used with any of the supported runtimes. The adaptation
is done with the help of HttpWebHandlerAdapter.
The processing chain can be assembled manually via builder methods, or
detected from Spring configuration via
applicationContext(ApplicationContext), or a mix of both.
HttpWebHandlerAdapter| Modifier and Type | Field and Description |
|---|---|
static String |
LOCALE_CONTEXT_RESOLVER_BEAN_NAME
Well-known name for the LocaleContextResolver in the bean factory.
|
static String |
SERVER_CODEC_CONFIGURER_BEAN_NAME
Well-known name for the ServerCodecConfigurer in the bean factory.
|
static String |
WEB_HANDLER_BEAN_NAME
Well-known name for the target WebHandler in the bean factory.
|
static String |
WEB_SESSION_MANAGER_BEAN_NAME
Well-known name for the WebSessionManager in the bean factory.
|
public static final String WEB_HANDLER_BEAN_NAME
public static final String WEB_SESSION_MANAGER_BEAN_NAME
public static final String SERVER_CODEC_CONFIGURER_BEAN_NAME
public static final String LOCALE_CONTEXT_RESOLVER_BEAN_NAME
public static WebHttpHandlerBuilder webHandler(WebHandler webHandler)
webHandler - the target handler for the requestpublic static WebHttpHandlerBuilder applicationContext(ApplicationContext context)
ApplicationContext. The following are detected:
WebHandler [1] -- looked up by the name
WEB_HANDLER_BEAN_NAME.
WebFilter [0..N] -- detected by type and ordered,
see AnnotationAwareOrderComparator.
WebExceptionHandler [0..N] -- detected by type and
ordered.
WebSessionManager [0..1] -- looked up by the name
WEB_SESSION_MANAGER_BEAN_NAME.
ServerCodecConfigurer [0..1] -- looked up by the name
SERVER_CODEC_CONFIGURER_BEAN_NAME.
LocaleContextResolver [0..1] -- looked up by the name
LOCALE_CONTEXT_RESOLVER_BEAN_NAME.
context - the application context to use for the lookuppublic WebHttpHandlerBuilder filter(WebFilter... filters)
filters - the filter(s) to add that'spublic WebHttpHandlerBuilder filters(Consumer<List<WebFilter>> consumer)
consumer - the consumer to usepublic WebHttpHandlerBuilder exceptionHandler(WebExceptionHandler... handlers)
handlers - the exception handler(s)public WebHttpHandlerBuilder exceptionHandlers(Consumer<List<WebExceptionHandler>> consumer)
consumer - the consumer to usepublic WebHttpHandlerBuilder sessionManager(WebSessionManager manager)
WebSessionManager to set on the
WebServerExchange.
By default DefaultWebSessionManager is used.
manager - the session managerHttpWebHandlerAdapter.setSessionManager(WebSessionManager)public WebHttpHandlerBuilder codecConfigurer(ServerCodecConfigurer codecConfigurer)
ServerCodecConfigurer to set on the
WebServerExchange.codecConfigurer - the codec configurerpublic WebHttpHandlerBuilder localeContextResolver(LocaleContextResolver localeContextResolver)
LocaleContextResolver to set on the
WebServerExchange.localeContextResolver - the locale context resolverpublic HttpHandler build()
HttpHandler.public WebHttpHandlerBuilder clone()
WebHttpHandlerBuilder.