Class PrefixingRequestMappingHandlerMapping
java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.handler.AbstractHandlerMapping
org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
com.foreach.across.modules.web.mvc.PrefixingRequestMappingHandlerMapping
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanNameAware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,org.springframework.context.EmbeddedValueResolverAware
,org.springframework.core.Ordered
,org.springframework.web.context.ServletContextAware
,org.springframework.web.servlet.handler.MatchableHandlerMapping
,org.springframework.web.servlet.HandlerMapping
public class PrefixingRequestMappingHandlerMapping
extends org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
Scans matching beans for RequestMapping annotations and (optionally) prefixes all mappings.
Allows for reloading (re-scanning) of mappings and re-initialization of the entire mapping handler mapping.
WARN: interceptors are only supported once.
Since 2.0.0 also supportsCustomRequestMapping
annotations on handler methods.
Any CustomRequestCondition
will be created using the AutowireCapableBeanFactory
of the attached
ApplicationContext
. Note it will be created as a new prototype bean, existing beans of that type will
be ignored.- See Also:
-
Field Summary
Fields inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping
mappingsLogger
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport
logger
Fields inherited from interface org.springframework.web.servlet.HandlerMapping
BEST_MATCHING_HANDLER_ATTRIBUTE, BEST_MATCHING_PATTERN_ATTRIBUTE, INTROSPECT_TYPE_LEVEL_MAPPING, LOOKUP_PATH, MATRIX_VARIABLES_ATTRIBUTE, PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, URI_TEMPLATE_VARIABLES_ATTRIBUTE
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionPrefixingRequestMappingHandlerMapping
(String prefixPath, org.springframework.aop.ClassFilter handlerMatcher) PrefixingRequestMappingHandlerMapping
(org.springframework.aop.ClassFilter handlerMatcher) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addInterceptor
(Object... interceptor) Add one ore more interceptors to the handler mapping.protected org.springframework.web.method.HandlerMethod
createHandlerMethod
(Object handler, Method method) protected org.springframework.web.servlet.mvc.method.RequestMappingInfo
createRequestMappingInfo
(org.springframework.web.bind.annotation.RequestMapping requestMapping, org.springframework.web.servlet.mvc.condition.RequestCondition<?> customCondition) protected void
detectHandlerMethods
(org.springframework.context.ApplicationContext context, Object handler) protected void
detectMappedInterceptors
(List<org.springframework.web.servlet.HandlerInterceptor> mappedInterceptors) protected org.springframework.web.servlet.mvc.condition.RequestCondition<?>
getCustomMethodCondition
(Method method) protected org.springframework.web.servlet.mvc.condition.RequestCondition<?>
getCustomTypeCondition
(Class<?> handlerType) protected org.springframework.web.servlet.mvc.method.RequestMappingInfo
getMappingForMethod
(Method method, Class<?> handlerType) protected void
protected boolean
void
reload()
void
void
scan
(org.springframework.context.ApplicationContext context, boolean includeAncestors) Scan a particular ApplicationContext for instances.Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
afterPropertiesSet, createRequestMappingInfo, getBuilderConfiguration, getContentNegotiationManager, getFileExtensions, getPathPrefixes, initCorsConfiguration, match, registerHandlerMethod, registerMapping, resolveEmbeddedValuesInPatterns, setContentNegotiationManager, setEmbeddedValueResolver, setPathPrefixes, setPatternParser, setUseRegisteredSuffixPatternMatch, setUseSuffixPatternMatch, setUseTrailingSlashMatch, useRegisteredSuffixPatternMatch, useSuffixPatternMatch, useTrailingSlashMatch
Methods inherited from class org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping
getDirectPaths, getHandlerInternal, getMappingComparator, getMappingPathPatterns, getMatchingMapping, handleMatch, handleNoMatch
Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping
detectHandlerMethods, getCandidateBeanNames, getCorsConfiguration, getHandlerMethods, getHandlerMethodsForMappingName, getNamingStrategy, handlerMethodsInitialized, hasCorsConfigurationSource, lookupHandlerMethod, processCandidateBean, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, unregisterMapping
Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping
adaptInterceptor, extendInterceptors, formatMappingName, getAdaptedInterceptors, getCorsConfigurationSource, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getPatternParser, getUrlPathHelper, initApplicationContext, initInterceptors, initLookupPath, setAlwaysUseFullPath, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper, usesPathPatterns
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.web.servlet.HandlerMapping
getHandler, usesPathPatterns
Methods inherited from interface org.springframework.web.servlet.handler.MatchableHandlerMapping
getPatternParser
-
Constructor Details
-
PrefixingRequestMappingHandlerMapping
public PrefixingRequestMappingHandlerMapping(org.springframework.aop.ClassFilter handlerMatcher) -
PrefixingRequestMappingHandlerMapping
public PrefixingRequestMappingHandlerMapping(String prefixPath, org.springframework.aop.ClassFilter handlerMatcher)
-
-
Method Details
-
getPrefixPath
-
initHandlerMethods
protected void initHandlerMethods()- Overrides:
initHandlerMethods
in classorg.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
-
addInterceptor
Add one ore more interceptors to the handler mapping.- Parameters:
interceptor
- Interceptors to add.
-
rescan
-
reload
public void reload() -
detectMappedInterceptors
protected void detectMappedInterceptors(List<org.springframework.web.servlet.HandlerInterceptor> mappedInterceptors) - Overrides:
detectMappedInterceptors
in classorg.springframework.web.servlet.handler.AbstractHandlerMapping
-
scan
public void scan(org.springframework.context.ApplicationContext context, boolean includeAncestors) Scan a particular ApplicationContext for instances.- Parameters:
context
- that should be scannedincludeAncestors
- should controllers from the parent application context be detected
-
detectHandlerMethods
protected void detectHandlerMethods(org.springframework.context.ApplicationContext context, Object handler) -
createHandlerMethod
protected org.springframework.web.method.HandlerMethod createHandlerMethod(Object handler, Method method) - Overrides:
createHandlerMethod
in classorg.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
-
isHandler
- Overrides:
isHandler
in classorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
-
getMappingForMethod
protected org.springframework.web.servlet.mvc.method.RequestMappingInfo getMappingForMethod(Method method, Class<?> handlerType) - Overrides:
getMappingForMethod
in classorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
-
createRequestMappingInfo
protected org.springframework.web.servlet.mvc.method.RequestMappingInfo createRequestMappingInfo(org.springframework.web.bind.annotation.RequestMapping requestMapping, org.springframework.web.servlet.mvc.condition.RequestCondition<?> customCondition) - Overrides:
createRequestMappingInfo
in classorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
-
getCustomTypeCondition
protected org.springframework.web.servlet.mvc.condition.RequestCondition<?> getCustomTypeCondition(Class<?> handlerType) - Overrides:
getCustomTypeCondition
in classorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
-
getCustomMethodCondition
protected org.springframework.web.servlet.mvc.condition.RequestCondition<?> getCustomMethodCondition(Method method) - Overrides:
getCustomMethodCondition
in classorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
-