HandlerMapping implementation that supports RouterFunctions.
If no RouterFunction is provided at
construction time, this mapping
will detect all router functions in the application context, and consult them in
order.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private List | |
| private RouterFunction |
| Access | Constructor and Description |
|---|---|
| public | |
| public | RouterFunctionMapping(RouterFunction<?>
the router function to use for mapping routerFunction)Create a |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterPropertiesSet()
Implements org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. |
| protected Object | getHandlerInternal(HttpServletRequest
current HTTP request servletRequest)Implements abstract org. Look up a handler for the given request, returning |
| public RouterFunction | |
| private void | |
| private void | |
| private void | |
| public RequestMatchResult | match(HttpServletRequest
the current request request, String the pattern to match pattern)Implements org. Determine whether the request matches the given pattern. |
| private void | setAttributes(HttpServletRequest servletRequest, ServerRequest request, HandlerFunction<?> handlerFunction)
|
| public void | setDetectHandlerFunctionsInAncestorContexts(boolean detectHandlerFunctionsInAncestorContexts)
Set whether to detect handler functions in ancestor ApplicationContexts. |
| public void | setMessageConverters(List<HttpMessageConverter<?>> messageConverters)
Set the message body converters to use. |
| public void |
| detectHandlerFunctionsInAncestorContexts | back to summary |
|---|---|
| private boolean detectHandlerFunctionsInAncestorContexts | |
| messageConverters | back to summary |
|---|---|
| private List<HttpMessageConverter<?>> messageConverters | |
| routerFunction | back to summary |
|---|---|
| private RouterFunction<?> routerFunction
| |
| RouterFunctionMapping | back to summary |
|---|---|
| public RouterFunctionMapping() Create an empty If this constructor is used, this mapping will detect all
| |
| RouterFunctionMapping | back to summary |
|---|---|
| public RouterFunctionMapping(RouterFunction<?> routerFunction) Create a If this constructor is used, no application context detection will occur.
| |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() throws Exception Implements org. Doc from org. Invoked by the containing This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. | |
| getHandlerInternal | back to summary |
|---|---|
| protected Object getHandlerInternal(HttpServletRequest servletRequest) throws Exception Implements abstract org. Doc from org. Look up a handler for the given request, returning On CORS pre-flight requests this method should return a match not for
the pre-flight request but for the expected actual request based on the URL
path, the HTTP methods from the "Access-Control-Request-Method" header, and
the headers from the "Access-Control-Request-Headers" header thus allowing
the CORS configuration to be obtained via Note This method may also return a pre-built
| |
| getRouterFunction | back to summary |
|---|---|
| public RouterFunction Return the configured Note When router functions are detected from the
ApplicationContext, this method may return
| |
| initMessageConverters | back to summary |
|---|---|
| private void initMessageConverters() Initializes a default set of message converters. | |
| initRouterFunctions | back to summary |
|---|---|
| private void initRouterFunctions() Detect all router functions in the current application context. | |
| logRouterFunctions | back to summary |
|---|---|
| private void logRouterFunctions(List<RouterFunction<?>> routerFunctions) | |
| match | back to summary |
|---|---|
| public RequestMatchResult match(HttpServletRequest request, String pattern) Implements org. Doc from org. Determine whether the request matches the given pattern. Use this method
when
| |
| setAttributes | back to summary |
|---|---|
| private void setAttributes(HttpServletRequest servletRequest, ServerRequest request, HandlerFunction<?> handlerFunction) | |
| setDetectHandlerFunctionsInAncestorContexts | back to summary |
|---|---|
| public void setDetectHandlerFunctionsInAncestorContexts(boolean detectHandlerFunctionsInAncestorContexts) Set whether to detect handler functions in ancestor ApplicationContexts. Default is "false": Only handler functions in the current ApplicationContext will be detected, i.e. only in the context that this HandlerMapping itself is defined in (typically the current DispatcherServlet's context). Switch this flag on to detect handler beans in ancestor contexts (typically the Spring root WebApplicationContext) as well. | |
| setMessageConverters | back to summary |
|---|---|
| public void setMessageConverters(List<HttpMessageConverter<?>> messageConverters) Set the message body converters to use. These converters are used to convert from and to HTTP requests and responses. | |
| setRouterFunction | back to summary |
|---|---|
| public void setRouterFunction(RouterFunction<?> routerFunction) Set the router function to map to. If this property is used, no application context detection will occur. | |