public class RepositoryRestHandlerMapping extends BasePathAwareHandlerMapping
RequestMappingHandlerMapping
implementation that will only find a handler method if a
Repository
is exported under that URL path segment. Also ensures the
OpenEntityManagerInViewInterceptor
is registered in the application context. The OEMIVI is required for the
REST exporter to function properly.BEST_MATCHING_HANDLER_ATTRIBUTE, BEST_MATCHING_PATTERN_ATTRIBUTE, INTROSPECT_TYPE_LEVEL_MAPPING, MATRIX_VARIABLES_ATTRIBUTE, PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE, PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, URI_TEMPLATE_VARIABLES_ATTRIBUTE
Constructor and Description |
---|
RepositoryRestHandlerMapping(ResourceMappings mappings,
RepositoryRestConfiguration config)
Creates a new
RepositoryRestHandlerMapping for the given ResourceMappings and
RepositoryRestConfiguration . |
RepositoryRestHandlerMapping(ResourceMappings mappings,
RepositoryRestConfiguration config,
org.springframework.data.repository.support.Repositories repositories)
Creates a new
RepositoryRestHandlerMapping for the given ResourceMappings
RepositoryRestConfiguration and Repositories . |
Modifier and Type | Method and Description |
---|---|
protected org.springframework.web.servlet.mvc.condition.ProducesRequestCondition |
customize(org.springframework.web.servlet.mvc.condition.ProducesRequestCondition condition)
Customize the given
ProducesRequestCondition . |
protected void |
extendInterceptors(List<Object> interceptors) |
protected org.springframework.web.cors.CorsConfiguration |
getCorsConfiguration(Object handler,
javax.servlet.http.HttpServletRequest request) |
protected org.springframework.web.method.HandlerMethod |
handleNoMatch(Set<org.springframework.web.servlet.mvc.method.RequestMappingInfo> requestMappingInfos,
String lookupPath,
javax.servlet.http.HttpServletRequest request) |
protected boolean |
isHandler(Class<?> beanType) |
protected org.springframework.web.method.HandlerMethod |
lookupHandlerMethod(String lookupPath,
javax.servlet.http.HttpServletRequest request) |
void |
setEmbeddedValueResolver(org.springframework.util.StringValueResolver resolver) |
void |
setJpaHelper(JpaHelper jpaHelper) |
afterPropertiesSet, customize, getMappingForMethod
createRequestMappingInfo, getContentNegotiationManager, getCustomMethodCondition, getCustomTypeCondition, getFileExtensions, getPathPrefixes, initCorsConfiguration, match, resolveEmbeddedValuesInPatterns, setContentNegotiationManager, setPathPrefixes, setUseRegisteredSuffixPatternMatch, setUseSuffixPatternMatch, setUseTrailingSlashMatch, useRegisteredSuffixPatternMatch, useSuffixPatternMatch, useTrailingSlashMatch
getMappingComparator, getMappingPathPatterns, getMatchingMapping, handleMatch
createHandlerMethod, detectHandlerMethods, getCandidateBeanNames, getHandlerInternal, getHandlerMethods, getHandlerMethodsForMappingName, getNamingStrategy, handlerMethodsInitialized, initHandlerMethods, processCandidateBean, registerHandlerMethod, registerMapping, setDetectHandlerMethodsInAncestorContexts, setHandlerMethodMappingNamingStrategy, unregisterMapping
adaptInterceptor, detectMappedInterceptors, formatMappingName, getAdaptedInterceptors, getCorsConfigurations, getCorsHandlerExecutionChain, getCorsProcessor, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getUrlPathHelper, initApplicationContext, initInterceptors, setAlwaysUseFullPath, setBeanName, setCorsConfigurations, setCorsConfigurationSource, setCorsProcessor, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, obtainApplicationContext, requiredContextClass, setApplicationContext
public RepositoryRestHandlerMapping(ResourceMappings mappings, RepositoryRestConfiguration config)
RepositoryRestHandlerMapping
for the given ResourceMappings
and
RepositoryRestConfiguration
.mappings
- must not be null.config
- must not be null.public RepositoryRestHandlerMapping(ResourceMappings mappings, RepositoryRestConfiguration config, org.springframework.data.repository.support.Repositories repositories)
RepositoryRestHandlerMapping
for the given ResourceMappings
RepositoryRestConfiguration
and Repositories
.mappings
- must not be null.config
- must not be null.repositories
- must not be null.public void setJpaHelper(JpaHelper jpaHelper)
jpaHelper
- the jpaHelper to setpublic void setEmbeddedValueResolver(org.springframework.util.StringValueResolver resolver)
setEmbeddedValueResolver
in interface org.springframework.context.EmbeddedValueResolverAware
setEmbeddedValueResolver
in class org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
protected org.springframework.web.method.HandlerMethod lookupHandlerMethod(String lookupPath, javax.servlet.http.HttpServletRequest request) throws Exception
lookupHandlerMethod
in class BasePathAwareHandlerMapping
Exception
protected org.springframework.web.method.HandlerMethod handleNoMatch(Set<org.springframework.web.servlet.mvc.method.RequestMappingInfo> requestMappingInfos, String lookupPath, javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException
handleNoMatch
in class org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping
javax.servlet.ServletException
protected boolean isHandler(Class<?> beanType)
isHandler
in class BasePathAwareHandlerMapping
protected void extendInterceptors(List<Object> interceptors)
extendInterceptors
in class org.springframework.web.servlet.handler.AbstractHandlerMapping
protected org.springframework.web.servlet.mvc.condition.ProducesRequestCondition customize(org.springframework.web.servlet.mvc.condition.ProducesRequestCondition condition)
BasePathAwareHandlerMapping
ProducesRequestCondition
. Default implementation returns the condition as is.customize
in class BasePathAwareHandlerMapping
condition
- will never be null.protected org.springframework.web.cors.CorsConfiguration getCorsConfiguration(Object handler, javax.servlet.http.HttpServletRequest request)
getCorsConfiguration
in class org.springframework.web.servlet.handler.AbstractHandlerMethodMapping<org.springframework.web.servlet.mvc.method.RequestMappingInfo>
Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.