Class AbstractWebMvcEndpointHandlerMapping

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.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.core.Ordered, org.springframework.web.context.ServletContextAware, org.springframework.web.servlet.HandlerMapping
Direct Known Subclasses:
AdditionalHealthEndpointPathsWebMvcHandlerMapping, WebMvcEndpointHandlerMapping

@ImportRuntimeHints(org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping.AbstractWebMvcEndpointHandlerMappingRuntimeHints.class) public abstract class AbstractWebMvcEndpointHandlerMapping extends org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping implements org.springframework.beans.factory.InitializingBean
A custom HandlerMapping that makes web endpoints available over HTTP using Spring MVC.
Since:
2.0.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static interface 
    Handler providing actuator links at the root endpoint.
    protected static interface 
    A servlet web operation that can be handled by Spring MVC.
  • 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
    AbstractWebMvcEndpointHandlerMapping(EndpointMapping endpointMapping, Collection<ExposableWebEndpoint> endpoints, EndpointMediaTypes endpointMediaTypes, boolean shouldRegisterLinksMapping)
    Creates a new WebEndpointHandlerMapping that provides mappings for the operations of the given webEndpoints.
    AbstractWebMvcEndpointHandlerMapping(EndpointMapping endpointMapping, Collection<ExposableWebEndpoint> endpoints, EndpointMediaTypes endpointMediaTypes, org.springframework.web.cors.CorsConfiguration corsConfiguration, boolean shouldRegisterLinksMapping)
    Creates a new AbstractWebMvcEndpointHandlerMapping that provides mappings for the operations of the given endpoints.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected org.springframework.web.method.HandlerMethod
    createHandlerMethod(Object handler, Method method)
     
    protected void
     
    Return the web endpoints being mapped.
    Return the Handler providing actuator links at the root endpoint.
    protected org.springframework.web.servlet.mvc.method.RequestMappingInfo
    getMappingForMethod(Method method, Class<?> handlerType)
     
    protected boolean
     
    protected org.springframework.web.cors.CorsConfiguration
    initCorsConfiguration(Object handler, Method method, org.springframework.web.servlet.mvc.method.RequestMappingInfo mapping)
     
    protected void
     
    protected boolean
    isHandler(Class<?> beanType)
     
    protected void
     
    Hook point that allows subclasses to wrap the AbstractWebMvcEndpointHandlerMapping.ServletWebOperation before it's called.

    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, lookupHandlerMethod, processCandidateBean, registerHandlerMethod, registerMapping, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, setPatternParser, unregisterMapping

    Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping

    adaptInterceptor, detectMappedInterceptors, 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
  • Constructor Details

    • AbstractWebMvcEndpointHandlerMapping

      public AbstractWebMvcEndpointHandlerMapping(EndpointMapping endpointMapping, Collection<ExposableWebEndpoint> endpoints, EndpointMediaTypes endpointMediaTypes, boolean shouldRegisterLinksMapping)
      Creates a new WebEndpointHandlerMapping that provides mappings for the operations of the given webEndpoints.
      Parameters:
      endpointMapping - the base mapping for all endpoints
      endpoints - the web endpoints
      endpointMediaTypes - media types consumed and produced by the endpoints
      shouldRegisterLinksMapping - whether the links endpoint should be registered
    • AbstractWebMvcEndpointHandlerMapping

      public AbstractWebMvcEndpointHandlerMapping(EndpointMapping endpointMapping, Collection<ExposableWebEndpoint> endpoints, EndpointMediaTypes endpointMediaTypes, org.springframework.web.cors.CorsConfiguration corsConfiguration, boolean shouldRegisterLinksMapping)
      Creates a new AbstractWebMvcEndpointHandlerMapping that provides mappings for the operations of the given endpoints.
      Parameters:
      endpointMapping - the base mapping for all endpoints
      endpoints - the web endpoints
      endpointMediaTypes - media types consumed and produced by the endpoints
      corsConfiguration - the CORS configuration for the endpoints or null
      shouldRegisterLinksMapping - whether the links endpoint should be registered
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Overrides:
      afterPropertiesSet in class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
    • initHandlerMethods

      protected void initHandlerMethods()
      Overrides:
      initHandlerMethods in class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
    • createHandlerMethod

      protected org.springframework.web.method.HandlerMethod createHandlerMethod(Object handler, Method method)
      Overrides:
      createHandlerMethod in class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
    • registerMapping

      protected void registerMapping(ExposableWebEndpoint endpoint, WebOperationRequestPredicate predicate, WebOperation operation, String path)
    • wrapServletWebOperation

      Hook point that allows subclasses to wrap the AbstractWebMvcEndpointHandlerMapping.ServletWebOperation before it's called. Allows additional features, such as security, to be added.
      Parameters:
      endpoint - the source endpoint
      operation - the source operation
      servletWebOperation - the servlet web operation to wrap
      Returns:
      a wrapped servlet web operation
    • hasCorsConfigurationSource

      protected boolean hasCorsConfigurationSource(Object handler)
      Overrides:
      hasCorsConfigurationSource in class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
    • initCorsConfiguration

      protected org.springframework.web.cors.CorsConfiguration initCorsConfiguration(Object handler, Method method, org.springframework.web.servlet.mvc.method.RequestMappingInfo mapping)
      Overrides:
      initCorsConfiguration in class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
    • isHandler

      protected boolean isHandler(Class<?> beanType)
      Specified by:
      isHandler 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)
      Specified by:
      getMappingForMethod in class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
    • extendInterceptors

      protected void extendInterceptors(List<Object> interceptors)
      Overrides:
      extendInterceptors in class org.springframework.web.servlet.handler.AbstractHandlerMapping
    • getLinksHandler

      protected abstract AbstractWebMvcEndpointHandlerMapping.LinksHandler getLinksHandler()
      Return the Handler providing actuator links at the root endpoint.
      Returns:
      the links handler
    • getEndpoints

      public Collection<ExposableWebEndpoint> getEndpoints()
      Return the web endpoints being mapped.
      Returns:
      the endpoints