类 AbstractEndpointHandlerMapping<E extends MvcEndpoint>
- 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
- org.springframework.boot.actuate.endpoint.mvc.AbstractEndpointHandlerMapping<E>
- 类型参数:
E
- The endpoint type
- 所有已实现的接口:
org.springframework.beans.factory.Aware
,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
- 直接已知子类:
EndpointHandlerMapping
public abstract class AbstractEndpointHandlerMapping<E extends MvcEndpoint> extends org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
HandlerMapping
to mapEndpoint
s to URLs viaEndpoint.getId()
. The semantics of@RequestMapping
should be identical to a normal@Controller
, but the endpoints should not be annotated as@Controller
(otherwise they will be mapped by the normal MVC mechanisms).One of the aims of the mapping is to support endpoints that work as HTTP endpoints but can still provide useful service interfaces when there is no HTTP server (and no Spring MVC on the classpath). Note that any endpoints having method signatures will break in a non-servlet environment.
构造器概要
构造器 构造器 说明 AbstractEndpointHandlerMapping(Collection<? extends E> endpoints)
Create a newAbstractEndpointHandlerMapping
instance.AbstractEndpointHandlerMapping(Collection<? extends E> endpoints, org.springframework.web.cors.CorsConfiguration corsConfiguration)
Create a newAbstractEndpointHandlerMapping
instance.
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
protected void
extendInterceptors(List<Object> interceptors)
protected org.springframework.web.servlet.HandlerExecutionChain
getCorsHandlerExecutionChain(javax.servlet.http.HttpServletRequest request, org.springframework.web.servlet.HandlerExecutionChain chain, org.springframework.web.cors.CorsConfiguration config)
Set<E>
getEndpoints()
Return the endpoints.protected org.springframework.web.servlet.HandlerExecutionChain
getHandlerExecutionChain(Object handler, javax.servlet.http.HttpServletRequest request)
String
getPath(String endpoint)
Get the path of the endpoint.protected String
getPath(MvcEndpoint endpoint)
Return the path that should be used to map the givenMvcEndpoint
.String
getPrefix()
Get the prefix used in mappings.protected org.springframework.web.cors.CorsConfiguration
initCorsConfiguration(Object handler, Method method, org.springframework.web.servlet.mvc.method.RequestMappingInfo mappingInfo)
boolean
isDisabled()
Returns if this mapping is disabled.protected boolean
isHandler(Class<?> beanType)
Since all handler beans are passed into the constructor there is no need to detect anything here.protected void
postProcessEndpoints(Set<E> endpoints)
Post process the endpoint setting before they are used.protected void
registerHandlerMethod(Object handler, Method method, org.springframework.web.servlet.mvc.method.RequestMappingInfo mapping)
已过时。void
setDisabled(boolean disabled)
Sets if this mapping is disabled.void
setPrefix(String prefix)
Set the prefix used in mappings.void
setSecurityInterceptor(org.springframework.web.servlet.HandlerInterceptor securityInterceptor)
Set the handler interceptor that will be used for security.从类继承的方法 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
createRequestMappingInfo, getContentNegotiationManager, getCustomMethodCondition, getCustomTypeCondition, getFileExtensions, getMappingForMethod, match, resolveEmbeddedValuesInPatterns, setContentNegotiationManager, setEmbeddedValueResolver, setUseRegisteredSuffixPatternMatch, setUseSuffixPatternMatch, setUseTrailingSlashMatch, useRegisteredSuffixPatternMatch, useSuffixPatternMatch, useTrailingSlashMatch
从类继承的方法 org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping
getMappingComparator, getMappingPathPatterns, getMatchingMapping, handleMatch, handleNoMatch
从类继承的方法 org.springframework.web.servlet.handler.AbstractHandlerMethodMapping
createHandlerMethod, detectHandlerMethods, getCorsConfiguration, getHandlerInternal, getHandlerMethods, getHandlerMethodsForMappingName, getNamingStrategy, handlerMethodsInitialized, initHandlerMethods, lookupHandlerMethod, registerMapping, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, unregisterMapping
从类继承的方法 org.springframework.web.servlet.handler.AbstractHandlerMapping
adaptInterceptor, detectMappedInterceptors, getAdaptedInterceptors, getCorsConfigurations, getCorsProcessor, getDefaultHandler, getHandler, getMappedInterceptors, getOrder, getPathMatcher, getUrlPathHelper, initApplicationContext, initInterceptors, setAlwaysUseFullPath, setCorsConfigurations, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper
从类继承的方法 org.springframework.web.context.support.WebApplicationObjectSupport
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
从类继承的方法 org.springframework.context.support.ApplicationObjectSupport
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext
构造器详细资料
AbstractEndpointHandlerMapping
public AbstractEndpointHandlerMapping(Collection<? extends E> endpoints)
Create a newAbstractEndpointHandlerMapping
instance. AllEndpoint
s will be detected from theApplicationContext
. The endpoints will not accept CORS requests.- 参数:
endpoints
- the endpoints
AbstractEndpointHandlerMapping
public AbstractEndpointHandlerMapping(Collection<? extends E> endpoints, org.springframework.web.cors.CorsConfiguration corsConfiguration)
Create a newAbstractEndpointHandlerMapping
instance. AllEndpoint
s will be detected from theApplicationContext
. The endpoints will accepts CORS requests based on the givencorsConfiguration
.- 参数:
endpoints
- the endpointscorsConfiguration
- the CORS configuration for the endpoints- 从以下版本开始:
- 1.3.0
方法详细资料
postProcessEndpoints
protected void postProcessEndpoints(Set<E> endpoints)
Post process the endpoint setting before they are used. Subclasses can add or modify the endpoints as necessary.- 参数:
endpoints
- the endpoints to post process
afterPropertiesSet
public void afterPropertiesSet()
- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 覆盖:
afterPropertiesSet
在类中org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
isHandler
protected boolean isHandler(Class<?> beanType)
Since all handler beans are passed into the constructor there is no need to detect anything here.- 覆盖:
isHandler
在类中org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
registerHandlerMethod
@Deprecated protected void registerHandlerMethod(Object handler, Method method, org.springframework.web.servlet.mvc.method.RequestMappingInfo mapping)
已过时。- 覆盖:
registerHandlerMethod
在类中org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
getPath
protected String getPath(MvcEndpoint endpoint)
Return the path that should be used to map the givenMvcEndpoint
.- 参数:
endpoint
- the endpoint to map- 返回:
- the path to use for the endpoint or
null
if no mapping is required
getHandlerExecutionChain
protected org.springframework.web.servlet.HandlerExecutionChain getHandlerExecutionChain(Object handler, javax.servlet.http.HttpServletRequest request)
- 覆盖:
getHandlerExecutionChain
在类中org.springframework.web.servlet.handler.AbstractHandlerMapping
getCorsHandlerExecutionChain
protected org.springframework.web.servlet.HandlerExecutionChain getCorsHandlerExecutionChain(javax.servlet.http.HttpServletRequest request, org.springframework.web.servlet.HandlerExecutionChain chain, org.springframework.web.cors.CorsConfiguration config)
- 覆盖:
getCorsHandlerExecutionChain
在类中org.springframework.web.servlet.handler.AbstractHandlerMapping
extendInterceptors
protected void extendInterceptors(List<Object> interceptors)
- 覆盖:
extendInterceptors
在类中org.springframework.web.servlet.handler.AbstractHandlerMapping
setSecurityInterceptor
public void setSecurityInterceptor(org.springframework.web.servlet.HandlerInterceptor securityInterceptor)
Set the handler interceptor that will be used for security.- 参数:
securityInterceptor
- the security handler interceptor
setPrefix
public void setPrefix(String prefix)
Set the prefix used in mappings.- 参数:
prefix
- the prefix
getPath
public String getPath(String endpoint)
Get the path of the endpoint.- 参数:
endpoint
- the endpoint- 返回:
- the path used in mappings
setDisabled
public void setDisabled(boolean disabled)
Sets if this mapping is disabled.- 参数:
disabled
- if the mapping is disabled
isDisabled
public boolean isDisabled()
Returns if this mapping is disabled.- 返回:
true
if the mapping is disabled
getEndpoints
public Set<E> getEndpoints()
Return the endpoints.- 返回:
- the endpoints
initCorsConfiguration
protected org.springframework.web.cors.CorsConfiguration initCorsConfiguration(Object handler, Method method, org.springframework.web.servlet.mvc.method.RequestMappingInfo mappingInfo)
- 覆盖:
initCorsConfiguration
在类中org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping