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<RequestMappingInfo>
org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping
org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping
- All Implemented Interfaces:
Aware,BeanNameAware,InitializingBean,ApplicationContextAware,Ordered,ServletContextAware,HandlerMapping
- Direct Known Subclasses:
AdditionalHealthEndpointPathsWebMvcHandlerMapping,WebMvcEndpointHandlerMapping
@ImportRuntimeHints(org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping.AbstractWebMvcEndpointHandlerMappingRuntimeHints.class)
public abstract class AbstractWebMvcEndpointHandlerMapping
extends RequestMappingInfoHandlerMapping
implements InitializingBean
A custom
HandlerMapping that makes web endpoints
available over HTTP using Spring MVC.- Since:
- 2.0.0
- Author:
- Andy Wilkinson, Madhura Bhave, Phillip Webb, Brian Clozel
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceHandler providing actuator links at the root endpoint.protected static interfaceA servlet web operation that can be handled by Spring MVC. -
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
ConstructorsConstructorDescriptionAbstractWebMvcEndpointHandlerMapping(EndpointMapping endpointMapping, Collection<ExposableWebEndpoint> endpoints, EndpointMediaTypes endpointMediaTypes, boolean shouldRegisterLinksMapping) Creates a newWebEndpointHandlerMappingthat provides mappings for the operations of the givenwebEndpoints.AbstractWebMvcEndpointHandlerMapping(EndpointMapping endpointMapping, Collection<ExposableWebEndpoint> endpoints, EndpointMediaTypes endpointMediaTypes, CorsConfiguration corsConfiguration, boolean shouldRegisterLinksMapping) Creates a newAbstractWebMvcEndpointHandlerMappingthat provides mappings for the operations of the given endpoints. -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected HandlerMethodcreateHandlerMethod(Object handler, Method method) protected voidextendInterceptors(List<Object> interceptors) Return the web endpoints being mapped.protected abstract AbstractWebMvcEndpointHandlerMapping.LinksHandlerReturn the Handler providing actuator links at the root endpoint.protected RequestMappingInfogetMappingForMethod(Method method, Class<?> handlerType) protected booleanhasCorsConfigurationSource(Object handler) protected CorsConfigurationinitCorsConfiguration(Object handler, Method method, RequestMappingInfo mapping) protected voidprotected booleanprotected voidregisterMapping(ExposableWebEndpoint endpoint, WebOperationRequestPredicate predicate, WebOperation operation, String path) wrapServletWebOperation(ExposableWebEndpoint endpoint, WebOperation operation, AbstractWebMvcEndpointHandlerMapping.ServletWebOperation servletWebOperation) Hook point that allows subclasses to wrap theAbstractWebMvcEndpointHandlerMapping.ServletWebOperationbefore it's called.Methods 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
detectHandlerMethods, getCandidateBeanNames, getCorsConfiguration, getHandlerMethods, getHandlerMethodsForMappingName, getNamingStrategy, handlerMethodsInitialized, lookupHandlerMethod, processCandidateBean, registerHandlerMethod, registerMapping, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, setPatternParser, unregisterMappingMethods 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, 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, setApplicationContext
-
Constructor Details
-
AbstractWebMvcEndpointHandlerMapping
public AbstractWebMvcEndpointHandlerMapping(EndpointMapping endpointMapping, Collection<ExposableWebEndpoint> endpoints, EndpointMediaTypes endpointMediaTypes, boolean shouldRegisterLinksMapping) Creates a newWebEndpointHandlerMappingthat provides mappings for the operations of the givenwebEndpoints.- Parameters:
endpointMapping- the base mapping for all endpointsendpoints- the web endpointsendpointMediaTypes- media types consumed and produced by the endpointsshouldRegisterLinksMapping- whether the links endpoint should be registered
-
AbstractWebMvcEndpointHandlerMapping
public AbstractWebMvcEndpointHandlerMapping(EndpointMapping endpointMapping, Collection<ExposableWebEndpoint> endpoints, EndpointMediaTypes endpointMediaTypes, CorsConfiguration corsConfiguration, boolean shouldRegisterLinksMapping) Creates a newAbstractWebMvcEndpointHandlerMappingthat provides mappings for the operations of the given endpoints.- Parameters:
endpointMapping- the base mapping for all endpointsendpoints- the web endpointsendpointMediaTypes- media types consumed and produced by the endpointscorsConfiguration- the CORS configuration for the endpoints ornullshouldRegisterLinksMapping- whether the links endpoint should be registered
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceInitializingBean- Overrides:
afterPropertiesSetin classAbstractHandlerMethodMapping<RequestMappingInfo>
-
initHandlerMethods
protected void initHandlerMethods()- Overrides:
initHandlerMethodsin classAbstractHandlerMethodMapping<RequestMappingInfo>
-
createHandlerMethod
- Overrides:
createHandlerMethodin classAbstractHandlerMethodMapping<RequestMappingInfo>
-
registerMapping
protected void registerMapping(ExposableWebEndpoint endpoint, WebOperationRequestPredicate predicate, WebOperation operation, String path) -
wrapServletWebOperation
protected AbstractWebMvcEndpointHandlerMapping.ServletWebOperation wrapServletWebOperation(ExposableWebEndpoint endpoint, WebOperation operation, AbstractWebMvcEndpointHandlerMapping.ServletWebOperation servletWebOperation) Hook point that allows subclasses to wrap theAbstractWebMvcEndpointHandlerMapping.ServletWebOperationbefore it's called. Allows additional features, such as security, to be added.- Parameters:
endpoint- the source endpointoperation- the source operationservletWebOperation- the servlet web operation to wrap- Returns:
- a wrapped servlet web operation
-
hasCorsConfigurationSource
- Overrides:
hasCorsConfigurationSourcein classAbstractHandlerMethodMapping<RequestMappingInfo>
-
initCorsConfiguration
protected CorsConfiguration initCorsConfiguration(Object handler, Method method, RequestMappingInfo mapping) - Overrides:
initCorsConfigurationin classAbstractHandlerMethodMapping<RequestMappingInfo>
-
isHandler
- Specified by:
isHandlerin classAbstractHandlerMethodMapping<RequestMappingInfo>
-
getMappingForMethod
- Specified by:
getMappingForMethodin classAbstractHandlerMethodMapping<RequestMappingInfo>
-
extendInterceptors
- Overrides:
extendInterceptorsin classAbstractHandlerMapping
-
getLinksHandler
Return the Handler providing actuator links at the root endpoint.- Returns:
- the links handler
-
getEndpoints
Return the web endpoints being mapped.- Returns:
- the endpoints
-