public class HandlerMappingIntrospector extends Object implements org.springframework.web.cors.CorsConfigurationSource, org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
HandlerMapping that would
serve a specific request.
Provides the following methods:
getMatchableHandlerMapping(javax.servlet.http.HttpServletRequest) — obtain a HandlerMapping
to check request-matching criteria against.
getCorsConfiguration(javax.servlet.http.HttpServletRequest) — obtain the CORS configuration for the
request.
Note: This is primarily an SPI to allow Spring Security to align its pattern matching with the same pattern matching that would be used in Spring MVC for a given request, in order to avoid security issues. Use of this introspector should be avoided for other purposes because it incurs the overhead of resolving the handler for a request.
| Constructor and Description |
|---|
HandlerMappingIntrospector()
Constructor for use with
ApplicationContextAware. |
HandlerMappingIntrospector(org.springframework.context.ApplicationContext context)
Deprecated.
as of 4.3.12, in favor of
setApplicationContext(org.springframework.context.ApplicationContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
org.springframework.web.cors.CorsConfiguration |
getCorsConfiguration(HttpServletRequest request) |
List<HandlerMapping> |
getHandlerMappings()
Return the configured or detected
HandlerMappings. |
MatchableHandlerMapping |
getMatchableHandlerMapping(HttpServletRequest request)
Find the
HandlerMapping that would handle the given request and
return it as a MatchableHandlerMapping that can be used to test
request-matching criteria. |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
public HandlerMappingIntrospector()
ApplicationContextAware.@Deprecated public HandlerMappingIntrospector(org.springframework.context.ApplicationContext context)
setApplicationContext(org.springframework.context.ApplicationContext)HandlerMappings in the
given ApplicationContext or falls back on
"DispatcherServlet.properties" like the DispatcherServlet.public List<HandlerMapping> getHandlerMappings()
HandlerMappings.public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext)
setApplicationContext in interface org.springframework.context.ApplicationContextAwarepublic void afterPropertiesSet()
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean@Nullable public MatchableHandlerMapping getMatchableHandlerMapping(HttpServletRequest request) throws Exception
HandlerMapping that would handle the given request and
return it as a MatchableHandlerMapping that can be used to test
request-matching criteria.
If the matching HandlerMapping is not an instance of
MatchableHandlerMapping, an IllegalStateException is raised.
request - the current requestnullException - if any of the HandlerMapping's raise an exception@Nullable public org.springframework.web.cors.CorsConfiguration getCorsConfiguration(HttpServletRequest request)
getCorsConfiguration in interface org.springframework.web.cors.CorsConfigurationSource