E
- The endpoint typepublic abstract class AbstractEndpointHandlerMapping<E extends MvcEndpoint>
extends org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
HandlerMapping
to map Endpoint
s to URLs via Endpoint.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.
Constructor and Description |
---|
AbstractEndpointHandlerMapping(Collection<? extends E> endpoints)
Create a new
AbstractEndpointHandlerMapping instance. |
AbstractEndpointHandlerMapping(Collection<? extends E> endpoints,
org.springframework.web.cors.CorsConfiguration corsConfiguration)
Create a new
AbstractEndpointHandlerMapping instance. |
Modifier and Type | Method and Description |
---|---|
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) |
protected String |
getPath(MvcEndpoint endpoint)
Return the path that should be used to map the given
MvcEndpoint . |
String |
getPath(String endpoint)
Get the path of the endpoint.
|
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)
Deprecated.
|
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.
|
createRequestMappingInfo, getContentNegotiationManager, getCustomMethodCondition, getCustomTypeCondition, getFileExtensions, getMappingForMethod, match, resolveEmbeddedValuesInPatterns, setContentNegotiationManager, setEmbeddedValueResolver, setUseRegisteredSuffixPatternMatch, setUseSuffixPatternMatch, setUseTrailingSlashMatch, useRegisteredSuffixPatternMatch, useSuffixPatternMatch, useTrailingSlashMatch
getMappingComparator, getMappingPathPatterns, getMatchingMapping, handleMatch, handleNoMatch
createHandlerMethod, detectHandlerMethods, getCorsConfiguration, getHandlerInternal, getHandlerMethods, getHandlerMethodsForMappingName, getNamingStrategy, handlerMethodsInitialized, initHandlerMethods, lookupHandlerMethod, registerMapping, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, unregisterMapping
adaptInterceptor, detectMappedInterceptors, getAdaptedInterceptors, getCorsConfigurations, getCorsProcessor, getDefaultHandler, getHandler, getMappedInterceptors, getOrder, getPathMatcher, getUrlPathHelper, initApplicationContext, initInterceptors, setAlwaysUseFullPath, setCorsConfigurations, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext
public AbstractEndpointHandlerMapping(Collection<? extends E> endpoints)
AbstractEndpointHandlerMapping
instance. All Endpoint
s
will be detected from the ApplicationContext
. The endpoints will not accept
CORS requests.endpoints
- the endpointspublic AbstractEndpointHandlerMapping(Collection<? extends E> endpoints, org.springframework.web.cors.CorsConfiguration corsConfiguration)
AbstractEndpointHandlerMapping
instance. All Endpoint
s
will be detected from the ApplicationContext
. The endpoints will accepts
CORS requests based on the given corsConfiguration
.endpoints
- the endpointscorsConfiguration
- the CORS configuration for the endpointsprotected void postProcessEndpoints(Set<E> endpoints)
endpoints
- the endpoints to post processpublic void afterPropertiesSet()
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
in class org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
protected boolean isHandler(Class<?> beanType)
isHandler
in class org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
@Deprecated protected void registerHandlerMethod(Object handler, Method method, org.springframework.web.servlet.mvc.method.RequestMappingInfo mapping)
registerHandlerMethod
in class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
protected String getPath(MvcEndpoint endpoint)
MvcEndpoint
.endpoint
- the endpoint to mapnull
if no mapping is requiredprotected org.springframework.web.servlet.HandlerExecutionChain getHandlerExecutionChain(Object handler, javax.servlet.http.HttpServletRequest request)
getHandlerExecutionChain
in class org.springframework.web.servlet.handler.AbstractHandlerMapping
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
in class org.springframework.web.servlet.handler.AbstractHandlerMapping
protected void extendInterceptors(List<Object> interceptors)
extendInterceptors
in class org.springframework.web.servlet.handler.AbstractHandlerMapping
public void setSecurityInterceptor(org.springframework.web.servlet.HandlerInterceptor securityInterceptor)
securityInterceptor
- the security handler interceptorpublic void setPrefix(String prefix)
prefix
- the prefixpublic String getPrefix()
public String getPath(String endpoint)
endpoint
- the endpointpublic void setDisabled(boolean disabled)
disabled
- if the mapping is disabledpublic boolean isDisabled()
true
if the mapping is disabledprotected org.springframework.web.cors.CorsConfiguration initCorsConfiguration(Object handler, Method method, org.springframework.web.servlet.mvc.method.RequestMappingInfo mappingInfo)
initCorsConfiguration
in class org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.