public class HandlerMappingIntrospector extends java.lang.Object implements CorsConfigurationSource, ApplicationContextAware, 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.
| Constructor and Description |
|---|
HandlerMappingIntrospector()
Constructor for use with
ApplicationContextAware. |
HandlerMappingIntrospector(ApplicationContext context)
Deprecated.
as of 4.3.12, in favor of
setApplicationContext(org.springframework.context.ApplicationContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
|
CorsConfiguration |
getCorsConfiguration(HttpServletRequest request)
Return a
CorsConfiguration based on the incoming request. |
java.util.List<HandlerMapping> |
getHandlerMappings()
Return the configured HandlerMapping's.
|
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(ApplicationContext applicationContext)
Set the ApplicationContext that this object runs in.
|
public HandlerMappingIntrospector()
ApplicationContextAware.@Deprecated public HandlerMappingIntrospector(ApplicationContext context)
setApplicationContext(org.springframework.context.ApplicationContext)HandlerMappings in the
given ApplicationContext or falls back on
"DispatcherServlet.properties" like the DispatcherServlet.public java.util.List<HandlerMapping> getHandlerMappings()
public void setApplicationContext(ApplicationContext applicationContext)
ApplicationContextAwareInvoked after population of normal bean properties but before an init callback such
as InitializingBean.afterPropertiesSet()
or a custom init-method. Invoked after ResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader),
ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher) and
MessageSourceAware, if applicable.
setApplicationContext in interface ApplicationContextAwareapplicationContext - the ApplicationContext object to be used by this objectBeanInitializationExceptionpublic void afterPropertiesSet()
InitializingBeanThis method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet in interface InitializingBeanpublic MatchableHandlerMapping getMatchableHandlerMapping(HttpServletRequest request) throws java.lang.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 requestnulljava.lang.Exception - if any of the HandlerMapping's raise an exceptionpublic CorsConfiguration getCorsConfiguration(HttpServletRequest request)
CorsConfigurationSourceCorsConfiguration based on the incoming request.getCorsConfiguration in interface CorsConfigurationSourceCorsConfiguration, or null if none