public class DispatcherHandler extends Object implements org.springframework.web.server.WebHandler, org.springframework.context.ApplicationContextAware
It can use any HandlerMapping
implementation to control the routing of
requests to handler objects. HandlerMapping objects can be defined as beans in
the application context.
It can use any HandlerAdapter
; this allows for using any handler interface.
HandlerAdapter objects can be added as beans in the application context.
It can use any HandlerResultHandler
; this allows to process the result of
the request handling. HandlerResultHandler objects can be added as beans in the
application context.
Constructor and Description |
---|
DispatcherHandler()
Create a new
DispatcherHandler which needs to be configured with
an ApplicationContext through setApplicationContext(org.springframework.context.ApplicationContext) . |
DispatcherHandler(org.springframework.context.ApplicationContext applicationContext)
Create a new
DispatcherHandler for the given ApplicationContext . |
Modifier and Type | Method and Description |
---|---|
reactor.core.publisher.Mono<Void> |
handle(org.springframework.web.server.ServerWebExchange exchange) |
protected void |
initStrategies(org.springframework.context.ApplicationContext context) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
static org.springframework.http.server.reactive.HttpHandler |
toHttpHandler(org.springframework.context.ApplicationContext applicationContext)
Expose a dispatcher-based
HttpHandler for the given application context,
typically for direct registration with an engine adapter such as
ServletHttpHandlerAdapter . |
static org.springframework.web.server.WebHandler |
toWebHandler(org.springframework.context.ApplicationContext applicationContext)
Expose a dispatcher-based
WebHandler for the given application context,
typically for further configuration with filters and exception handlers through
a WebHttpHandlerBuilder . |
public DispatcherHandler()
DispatcherHandler
which needs to be configured with
an ApplicationContext
through setApplicationContext(org.springframework.context.ApplicationContext)
.public DispatcherHandler(org.springframework.context.ApplicationContext applicationContext)
DispatcherHandler
for the given ApplicationContext
.applicationContext
- the application context to find the handler beans inpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
protected void initStrategies(org.springframework.context.ApplicationContext context)
public reactor.core.publisher.Mono<Void> handle(org.springframework.web.server.ServerWebExchange exchange)
handle
in interface org.springframework.web.server.WebHandler
public static org.springframework.web.server.WebHandler toWebHandler(org.springframework.context.ApplicationContext applicationContext)
WebHandler
for the given application context,
typically for further configuration with filters and exception handlers through
a WebHttpHandlerBuilder
.applicationContext
- the application context to find the handler beans inDispatcherHandler(ApplicationContext)
,
WebHttpHandlerBuilder.webHandler(org.springframework.web.server.WebHandler)
public static org.springframework.http.server.reactive.HttpHandler toHttpHandler(org.springframework.context.ApplicationContext applicationContext)
HttpHandler
for the given application context,
typically for direct registration with an engine adapter such as
ServletHttpHandlerAdapter
.applicationContext
- the application context to find the handler beans inDispatcherHandler(ApplicationContext)
,
HttpWebHandlerAdapter
,
ServletHttpHandlerAdapter
,
ReactorHttpHandlerAdapter
,
RxNettyHttpHandlerAdapter
,
UndertowHttpHandlerAdapter