Class HandlerMappingIntrospector
- All Implemented Interfaces:
- Aware,- InitializingBean,- ApplicationContextAware,- CorsConfigurationSource
HandlerMapping that would
 serve a specific request.
 Provides the following methods:
- getMatchableHandlerMapping(jakarta.servlet.http.HttpServletRequest)— obtain a- HandlerMappingto check request-matching criteria against.
- getCorsConfiguration(jakarta.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.
- Since:
- 4.3.1
- Author:
- Rossen Stoyanchev
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.getCorsConfiguration(HttpServletRequest request) Return aCorsConfigurationbased on the incoming request.Return the configured or detectedHandlerMappings.Find theHandlerMappingthat would handle the given request and return it as aMatchableHandlerMappingthat can be used to test request-matching criteria.voidsetApplicationContext(ApplicationContext applicationContext) Set the ApplicationContext that this object runs in.
- 
Constructor Details- 
HandlerMappingIntrospectorpublic HandlerMappingIntrospector()
 
- 
- 
Method Details- 
setApplicationContextDescription copied from interface:ApplicationContextAwareSet the ApplicationContext that this object runs in. Normally this call will be used to initialize the object.Invoked after population of normal bean properties but before an init callback such as InitializingBean.afterPropertiesSet()or a custom init-method. Invoked afterResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader),ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)andMessageSourceAware, if applicable.- Specified by:
- setApplicationContextin interface- ApplicationContextAware
- Parameters:
- applicationContext- the ApplicationContext object to be used by this object
- See Also:
 
- 
afterPropertiesSetpublic void afterPropertiesSet()Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set. - Specified by:
- afterPropertiesSetin interface- InitializingBean
 
- 
getHandlerMappingsReturn the configured or detectedHandlerMappings.
- 
getMatchableHandlerMapping@Nullable public MatchableHandlerMapping getMatchableHandlerMapping(HttpServletRequest request) throws Exception Find theHandlerMappingthat would handle the given request and return it as aMatchableHandlerMappingthat can be used to test request-matching criteria.If the matching HandlerMapping is not an instance of MatchableHandlerMapping, an IllegalStateException is raised.- Parameters:
- request- the current request
- Returns:
- the resolved matcher, or null
- Throws:
- Exception- if any of the HandlerMapping's raise an exception
 
- 
getCorsConfigurationDescription copied from interface:CorsConfigurationSourceReturn aCorsConfigurationbased on the incoming request.- Specified by:
- getCorsConfigurationin interface- CorsConfigurationSource
- Returns:
- the associated CorsConfiguration, ornullif none
 
 
-