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.
|
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)
HandlerMapping
s in the
given ApplicationContext
or falls back on
"DispatcherServlet.properties" like the DispatcherServlet
.public java.util.List<HandlerMapping> getHandlerMappings()
public void setApplicationContext(ApplicationContext applicationContext)
ApplicationContextAware
Invoked 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 ApplicationContextAware
applicationContext
- the ApplicationContext object to be used by this objectBeanInitializationException
public void afterPropertiesSet()
InitializingBean
This 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 InitializingBean
@Nullable public 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 requestnull
java.lang.Exception
- if any of the HandlerMapping's raise an exception@Nullable public CorsConfiguration getCorsConfiguration(HttpServletRequest request)
CorsConfigurationSource
CorsConfiguration
based on the incoming request.getCorsConfiguration
in interface CorsConfigurationSource
CorsConfiguration
, or null
if none