HandlerMapping that would
serve a specific request.
Provides the following methods:
getMatchableHandlerMapping — obtain a HandlerMapping
to check request-matching criteria against.
getCorsConfiguration — obtain the CORS configuration for the
request.
Note that 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 component incurs the performance overhead of mapping the
request, and should not be repeated multiple times per request.
createCacheFilter() exposes a Filter to cache the results.
Applications that rely on Spring Security don't need to deploy this Filter
since Spring Security doe that. However, other custom security layers, used
in place of Spring Security that use this component should deploy the cache
Filter with requirements described in the Javadoc for the method.
| Modifier and Type | Class and Description |
|---|---|
| private static class | HandlerMappingIntrospector.
Request wrapper that buffers request attributes in order protect the underlying request from attribute changes. |
| public static class | HandlerMappingIntrospector.
Container for a |
| private static class | |
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private ApplicationContext | |
| private static final String | |
| private final HandlerMappingIntrospector. | |
| private List | |
| private static final Log | |
| private Map |
| Access | Constructor and Description |
|---|---|
| public |
| 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. |
| public Filter | Returns: the Filter instance to use
|
| private MatchableHandlerMapping | |
| private <T> T | doWithHandlerMapping(HttpServletRequest request, boolean ignoreException, BiFunction<HandlerMapping, HandlerExecutionChain, T> extractor)
|
| public CorsConfiguration | getCorsConfiguration(HttpServletRequest request)
Implements org. Return a |
| private static CorsConfiguration | |
| public List | |
| public MatchableHandlerMapping | Returns: the resolvedMatchableHandlerMapping, or nullthe current request request)Find the |
| private static List | |
| private static List | |
| public void | resetCache(ServletRequest request, HandlerMappingIntrospector.
Restore a previous |
| public void | setApplicationContext(ApplicationContext
the ApplicationContext object to be used by this object applicationContext)Implements org. Set the ApplicationContext that this object runs in. Normally this call will be used to initialize the object. |
| public HandlerMappingIntrospector. | Returns: the previousCachedResult, if there is one from a parent dispatchthe current request request)Perform a lookup and save the |
| applicationContext | back to summary |
|---|---|
| private ApplicationContext applicationContext
| |
| CACHED_RESULT_ATTRIBUTE | back to summary |
|---|---|
| private static final String CACHED_RESULT_ATTRIBUTE | |
| cacheLogHelper | back to summary |
|---|---|
| private final HandlerMappingIntrospector. | |
| handlerMappings | back to summary |
|---|---|
| private List<HandlerMapping> handlerMappings
| |
| logger | back to summary |
|---|---|
| private static final Log logger | |
| pathPatternMappings | back to summary |
|---|---|
| private Map<HandlerMapping, PathPatternMatchableHandlerMapping> pathPatternMappings | |
| HandlerMappingIntrospector | back to summary |
|---|---|
| public HandlerMappingIntrospector() | |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() 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.
| |
| createCacheFilter | back to summary |
|---|---|
| public Filter createCacheFilter()
Note Applications that rely on Spring Security do
not use this component directly and should not deploy the filter instead
allowing Spring Security to do it. Other custom security layers used in
place of Spring Security that also rely on
| |
| createMatchableHandlerMapping | back to summary |
|---|---|
| private MatchableHandlerMapping createMatchableHandlerMapping(HandlerMapping mapping, HttpServletRequest request) | |
| doWithHandlerMapping | back to summary |
|---|---|
private <T> T doWithHandlerMapping(HttpServletRequest request, boolean ignoreException, BiFunction<HandlerMapping, HandlerExecutionChain, T> extractor) throws Exception
| |
| getCorsConfiguration | back to summary |
|---|---|
| public CorsConfiguration getCorsConfiguration(HttpServletRequest request) Implements org. Doc from org. Return a
| |
| getCorsConfiguration | back to summary |
|---|---|
private static CorsConfiguration getCorsConfiguration(HandlerExecutionChain chain, HttpServletRequest request)
| |
| getHandlerMappings | back to summary |
|---|---|
| public List Return the configured or detected | |
| getMatchableHandlerMapping | back to summary |
|---|---|
| public MatchableHandlerMapping getMatchableHandlerMapping(HttpServletRequest request) throws Exception Find the
| |
| initFallback | back to summary |
|---|---|
| private static List | |
| initHandlerMappings | back to summary |
|---|---|
| private static List | |
| resetCache | back to summary |
|---|---|
| public void resetCache(ServletRequest request, HandlerMappingIntrospector. Restore a previous
| |
| setApplicationContext | back to summary |
|---|---|
| public void setApplicationContext(ApplicationContext applicationContext) Implements org. Doc from org. Set 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
| |
| setCache | back to summary |
|---|---|
| public HandlerMappingIntrospector. Perform a lookup and save the
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public Object | getAttribute(String
a name)String specifying the name of the attributeOverrides jakarta. Implements jakarta. Returns the value of the named attribute as an |
| public Enumeration | getAttributeNames()
Overrides jakarta. Implements jakarta. Returns an |
| private Map | |
| public void | removeAttribute(String
a name)String specifying the name of the attribute to removeOverrides jakarta. Implements jakarta. Removes an attribute from this request. |
| public void | setAttribute(String
a name, Object String specifying the name of the attributethe value)Object to be storedOverrides jakarta. Implements jakarta. Stores an attribute in this request. |
| attributes | back to summary |
|---|---|
| private final Map<String, Object> attributes | |
| AttributesPreservingRequest | back to summary |
|---|---|
| pack-priv AttributesPreservingRequest(HttpServletRequest request) | |
| getAttribute | back to summary |
|---|---|
| public Object getAttribute(String name) Overrides jakarta. Implements jakarta. Doc from jakarta. Returns the value of the named attribute as an
Attributes can be set two ways. The servlet container may set attributes to make available custom information
about a request. For example, for requests made using HTTPS, the attribute
Attribute names should follow the same conventions as package names. Names beginning with | |
| getAttributeNames | back to summary |
|---|---|
| public Enumeration Overrides jakarta. Implements jakarta. Doc from jakarta. Returns an
| |
| initAttributes | back to summary |
|---|---|
| private Map | |
| removeAttribute | back to summary |
|---|---|
| public void removeAttribute(String name) Overrides jakarta. Implements jakarta. Doc from jakarta. Removes an attribute from this request. This method is not generally needed as attributes only persist as long as the request is being handled.
Attribute names should follow the same conventions as package names. Names beginning with | |
| setAttribute | back to summary |
|---|---|
| public void setAttribute(String name, Object value) Overrides jakarta. Implements jakarta. Doc from jakarta. Stores an attribute in this request. Attributes are reset between requests. This method is most often used in
conjunction with
Attribute names should follow the same conventions as package names. Names beginning with
If the object passed in is null, the effect is the same as calling | |
MatchableHandlerMapping and CorsConfiguration
for a given request matched by dispatcher type and requestURI.
| Modifier and Type | Field and Description |
|---|---|
| private final CorsConfiguration | |
| private final IllegalStateException | |
| private final DispatcherType | |
| private final Exception | |
| private final MatchableHandlerMapping | |
| private final String |
| Access | Constructor and Description |
|---|---|
| private | CachedResult(HttpServletRequest request, MatchableHandlerMapping mapping, CorsConfiguration config, Exception failure, IllegalStateException corsConfigFailure)
|
| Modifier and Type | Method and Description |
|---|---|
| public CorsConfiguration | |
| public MatchableHandlerMapping | |
| public static HandlerMappingIntrospector. | |
| public boolean | |
| public String |
| corsConfig | back to summary |
|---|---|
| private final CorsConfiguration corsConfig
| |
| corsConfigFailure | back to summary |
|---|---|
| private final IllegalStateException corsConfigFailure
| |
| dispatcherType | back to summary |
|---|---|
| private final DispatcherType dispatcherType | |
| failure | back to summary |
|---|---|
| private final Exception failure
| |
| handlerMapping | back to summary |
|---|---|
| private final MatchableHandlerMapping handlerMapping
| |
| requestURI | back to summary |
|---|---|
| private final String requestURI | |
| CachedResult | back to summary |
|---|---|
| private CachedResult(HttpServletRequest request, MatchableHandlerMapping mapping, CorsConfiguration config, Exception failure, IllegalStateException corsConfigFailure) | |
| getCorsConfig | back to summary |
|---|---|
public CorsConfiguration getCorsConfig()
| |
| getHandlerMapping | back to summary |
|---|---|
public MatchableHandlerMapping getHandlerMapping() throws Exception
| |
| getResultFor | back to summary |
|---|---|
| public static HandlerMappingIntrospector. Return a
| |
| matches | back to summary |
|---|---|
| public boolean matches(HttpServletRequest request) | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Field and Description |
|---|---|
| private final Map |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static String | |
| private void | |
| public void | |
| public void |
| counters | back to summary |
|---|---|
| private final Map<String, AtomicInteger> counters | |
| CacheResultLogHelper | back to summary |
|---|---|
| private CacheResultLogHelper() | |
| getLogMessage | back to summary |
|---|---|
| private static String getLogMessage(String label, HttpServletRequest request) | |
| logCacheMiss | back to summary |
|---|---|
| private void logCacheMiss(String label, HttpServletRequest request) | |
| logCorsConfigCacheMiss | back to summary |
|---|---|
| public void logCorsConfigCacheMiss(HttpServletRequest request) | |
| logHandlerMappingCacheMiss | back to summary |
|---|---|
| public void logHandlerMappingCacheMiss(HttpServletRequest request) | |
| Modifier and Type | Field and Description |
|---|---|
| private final MatchableHandlerMapping | |
| private final Object | |
| private final String |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public HandlerExecutionChain | getHandler(HttpServletRequest
current HTTP request request)Implements org. Return a handler and any interceptors for this request. |
| public PathPatternParser | getPatternParser()
Overrides default org. Return the parser of this |
| private String | |
| public RequestMatchResult | match(HttpServletRequest
the current request request, String the pattern to match pattern)Implements org. Determine whether the request matches the given pattern. |
| delegate | back to summary |
|---|---|
| private final MatchableHandlerMapping delegate | |
| lookupPath | back to summary |
|---|---|
| private final Object lookupPath | |
| pathAttributeName | back to summary |
|---|---|
| private final String pathAttributeName | |
| LookupPathMatchableHandlerMapping | back to summary |
|---|---|
| pack-priv LookupPathMatchableHandlerMapping(MatchableHandlerMapping delegate, Object lookupPath) | |
| getHandler | back to summary |
|---|---|
| public HandlerExecutionChain getHandler(HttpServletRequest request) throws Exception Implements org. Doc from org. Return a handler and any interceptors for this request. The choice may be made on request URL, session state, or any factor the implementing class chooses. The returned HandlerExecutionChain contains a handler Object, rather than even a tag interface, so that handlers are not constrained in any way. For example, a HandlerAdapter could be written to allow another framework's handler objects to be used. Returns
| |
| getPatternParser | back to summary |
|---|---|
| public PathPatternParser getPatternParser() Overrides default org. Doc from org. Return the parser of this
| |
| initFullPathPattern | back to summary |
|---|---|
| private String initFullPathPattern(String pattern) | |
| 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
| |