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.ycommercewebservices.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

    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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Looks for overridden request mapping.
    int
     
    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 by RequestMappingOverride annotation
    protected Integer
    Gets method priority value based on RequestMappingOverride annotation.
    Map<org.springframework.web.servlet.mvc.method.RequestMappingInfo,Integer>
     
    protected boolean
    Checks if method has RequestMappingOverride annotation
    protected void
    Scan beans in the ApplicationContext, detect and register handler methods.
    protected void
    Scan beans in the ApplicationContext, detect and register overridden request mappings.
    protected boolean
    isHandler(Class<?> beanType)
     
    protected boolean
    isRequestMappingOverridden(org.springframework.web.servlet.mvc.method.RequestMappingInfo mapping, Method method)
    Method checks if mapping was overridden
    protected void
    registerOverriddenMapping(Method method, org.springframework.web.servlet.mvc.method.RequestMappingInfo mapping)
    Adds overridden request mapping to map
    void
    setDefaultRequestMappingOverridePriority(int defaultRequestMappingOverridePriority)
     
    void
    setDetectHandlerMethodsInAncestorContexts(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, 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

    createHandlerMethod, detectHandlerMethods, getCandidateBeanNames, getCorsConfiguration, getHandlerMethods, getHandlerMethodsForMappingName, getNamingStrategy, handlerMethodsInitialized, hasCorsConfigurationSource, lookupHandlerMethod, processCandidateBean, setHandlerMethodMappingNamingStrategy, setPatternParser, unregisterMapping

    Methods 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, 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

    • CommerceHandlerMapping

      public CommerceHandlerMapping(String apiVersion)
      Parameters:
      apiVersion - - Api version for which this request handler mapping should be defined
  • Method Details

    • isHandler

      protected boolean isHandler(Class<?> beanType)
      Overrides:
      isHandler in class org.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:
      initHandlerMethods in class org.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 by RequestMappingOverride annotation
      Overrides:
      getMappingForMethod in class org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
      Returns:
      the created RequestMappingInfo, or null if the method does not have a @RequestMapping annotation or mapping was overridden by RequestMappingOverride annotation.
    • isRequestMappingOverridden

      protected boolean isRequestMappingOverridden(org.springframework.web.servlet.mvc.method.RequestMappingInfo mapping, Method method)
      Method checks if mapping was overridden
    • hasRequestMappingOverrideAnnotation

      protected boolean hasRequestMappingOverrideAnnotation(Method method)
      Checks if method has RequestMappingOverride annotation
    • getMethodPriorityValue

      protected Integer getMethodPriorityValue(Method method)
      Gets method priority value based on RequestMappingOverride annotation. Priority value is read from properties files (project.properties, local.properties). If there is no priorityProperty then <className>.<methodName>.priority will 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

      protected void detectOverriddenMappings(Object handler)
      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:
      setDetectHandlerMethodsInAncestorContexts in class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
    • getOverriddenRequestMapping

      public Map<org.springframework.web.servlet.mvc.method.RequestMappingInfo,Integer> getOverriddenRequestMapping()
    • getDefaultRequestMappingOverridePriority

      public int getDefaultRequestMappingOverridePriority()
    • setDefaultRequestMappingOverridePriority

      public void setDefaultRequestMappingOverridePriority(int defaultRequestMappingOverridePriority)