Class CommerceHandlerMapping
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
de.hybris.platform.commercewebservices.core.request.mapping.handler.CommerceHandlerMapping
- 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 CommerceHandlerMapping
extends org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
Creates
RequestMappingInfo instances from type and method-level @RequestMapping
annotations in @Controller classes. Additionally it resolve RequestMapping conflicts base on
@RequestMappingOverride annotation. Method with highest priority will be added as
handler mapping. CommerceHandlerMapping use also @ApiVersion annotation to avoid adding request
mapping dedicated for different API version of commerce web services-
Field Summary
Fields inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping
mappingsLoggerFields inherited from class org.springframework.context.support.ApplicationObjectSupport
loggerFields 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_ATTRIBUTEFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddetectOverriddenMappings(Object handler) Looks for overridden request mapping.intprotected org.springframework.web.servlet.mvc.method.RequestMappingInfogetMappingForMethod(Method method, Class<?> handlerType) Gets mapping from parent method and check if it wasn't overridden byRequestMappingOverrideannotationprotected IntegergetMethodPriorityValue(Method method) Gets method priority value based onRequestMappingOverrideannotation.protected booleanChecks if method hasRequestMappingOverrideannotationprotected voidScan beans in the ApplicationContext, detect and register handler methods.protected voidScan beans in the ApplicationContext, detect and register overridden request mappings.protected booleanprotected booleanisRequestMappingOverridden(org.springframework.web.servlet.mvc.method.RequestMappingInfo mapping, Method method) Method checks if mapping was overriddenprotected voidregisterOverriddenMapping(Method method, org.springframework.web.servlet.mvc.method.RequestMappingInfo mapping) Adds overridden request mapping to mapvoidsetDefaultRequestMappingOverridePriority(int defaultRequestMappingOverridePriority) voidsetDetectHandlerMethodsInAncestorContexts(boolean detectHandlerMethodsInAncestorContexts) Methods inherited from class org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
afterPropertiesSet, createRequestMappingInfo, getBuilderConfiguration, getContentNegotiationManager, getCustomMethodCondition, getCustomTypeCondition, getFileExtensions, getPathPrefixes, initCorsConfiguration, match, registerHandlerMethod, registerMapping, resolveEmbeddedValuesInPatterns, setContentNegotiationManager, setEmbeddedValueResolver, setPathPrefixes, setUseRegisteredSuffixPatternMatch, setUseSuffixPatternMatch, setUseTrailingSlashMatch, useRegisteredSuffixPatternMatch, useSuffixPatternMatch, useTrailingSlashMatchMethods inherited from class org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping
getDirectPaths, getHandlerInternal, getMappingComparator, getMappingPathPatterns, getMatchingMapping, handleMatch, handleNoMatchMethods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping
createHandlerMethod, detectHandlerMethods, getCandidateBeanNames, getCorsConfiguration, getHandlerMethods, getHandlerMethodsForMappingName, getNamingStrategy, handlerMethodsInitialized, hasCorsConfigurationSource, lookupHandlerMethod, processCandidateBean, setHandlerMethodMappingNamingStrategy, setPatternParser, unregisterMappingMethods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping
adaptInterceptor, detectMappedInterceptors, 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, usesPathPatternsMethods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContextMethods inherited from class org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.servlet.HandlerMapping
getHandler, usesPathPatternsMethods inherited from interface org.springframework.web.servlet.handler.MatchableHandlerMapping
getPatternParser
-
Constructor Details
-
CommerceHandlerMapping
- Parameters:
apiVersion- - Api version for which this request handler mapping should be defined
-
-
Method Details
-
isHandler
- Overrides:
isHandlerin classorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
-
initHandlerMethods
protected void initHandlerMethods()Scan beans in the ApplicationContext, detect and register handler methods. Additionally this method detect which request mapping was overridden- Overrides:
initHandlerMethodsin classorg.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
-
getMappingForMethod
protected org.springframework.web.servlet.mvc.method.RequestMappingInfo getMappingForMethod(Method method, Class<?> handlerType) Gets mapping from parent method and check if it wasn't overridden byRequestMappingOverrideannotation- Overrides:
getMappingForMethodin classorg.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping- Returns:
- the created RequestMappingInfo, or
nullif the method does not have a@RequestMappingannotation or mapping was overridden byRequestMappingOverrideannotation.
-
isRequestMappingOverridden
protected boolean isRequestMappingOverridden(org.springframework.web.servlet.mvc.method.RequestMappingInfo mapping, Method method) Method checks if mapping was overridden -
hasRequestMappingOverrideAnnotation
Checks if method hasRequestMappingOverrideannotation -
getMethodPriorityValue
Gets method priority value based onRequestMappingOverrideannotation. Priority value is read from properties files (project.properties, local.properties). If there is nopriorityPropertythen<className>.<methodName>.prioritywill be used as property name. If there is no value for property with given name, default value = 0 will be returned. -
initOverridenRequestMappings
protected void initOverridenRequestMappings()Scan beans in the ApplicationContext, detect and register overridden request mappings. -
detectOverriddenMappings
Looks for overridden request mapping.- Parameters:
handler- the bean name of a handler or a handler instance
-
registerOverriddenMapping
protected void registerOverriddenMapping(Method method, org.springframework.web.servlet.mvc.method.RequestMappingInfo mapping) Adds overridden request mapping to map -
setDetectHandlerMethodsInAncestorContexts
public void setDetectHandlerMethodsInAncestorContexts(boolean detectHandlerMethodsInAncestorContexts) - Overrides:
setDetectHandlerMethodsInAncestorContextsin classorg.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
-
getOverriddenRequestMapping
-
getDefaultRequestMappingOverridePriority
public int getDefaultRequestMappingOverridePriority() -
setDefaultRequestMappingOverridePriority
public void setDefaultRequestMappingOverridePriority(int defaultRequestMappingOverridePriority)
-