org.springframework.web.servlet.mvc.method.annotation
Class RequestMappingHandlerMapping
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.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping
- All Implemented Interfaces:
- Aware, ApplicationContextAware, Ordered, ServletContextAware, HandlerMapping
public class RequestMappingHandlerMapping
- extends RequestMappingInfoHandlerMapping
Creates RequestMappingInfo
instances from type and method-level
@RequestMapping
annotations in
@Controller
classes.
- Since:
- 3.1
- Author:
- Arjen Poutsma, Rossen Stoyanchev
Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping |
adaptInterceptor, detectMappedInterceptors, extendInterceptors, getAdaptedInterceptors, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getUrlPathHelper, initInterceptors, setAlwaysUseFullPath, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setUrlDecode, setUrlPathHelper |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
useSuffixPatternMatch
private boolean useSuffixPatternMatch
RequestMappingHandlerMapping
public RequestMappingHandlerMapping()
setUseSuffixPatternMatch
public void setUseSuffixPatternMatch(boolean useSuffixPatternMatch)
- Whether to use suffix pattern match (".*") when matching patterns to
requests. If enabled a method mapped to "/users" also matches to
"/users.*". The default value is "true".
useSuffixPatternMatch
public boolean useSuffixPatternMatch()
- Whether to use suffix pattern matching.
isHandler
protected boolean isHandler(java.lang.Class<?> beanType)
- Whether the given type is a handler with handler methods.
Expects a handler to have a type-level @
Controller
annotation.
- Specified by:
isHandler
in class AbstractHandlerMethodMapping<RequestMappingInfo>
- Parameters:
beanType
- the type of the bean being checked
- Returns:
- "true" if this a handler type, "false" otherwise.
getMappingForMethod
protected RequestMappingInfo getMappingForMethod(java.lang.reflect.Method method,
java.lang.Class<?> handlerType)
- Uses method and type-level @
RequestMapping
annotations to create
the RequestMappingInfo.
- Specified by:
getMappingForMethod
in class AbstractHandlerMethodMapping<RequestMappingInfo>
- Parameters:
method
- the method to provide a mapping forhandlerType
- the handler type, possibly a sub-type of the method's
declaring class
- Returns:
- the created RequestMappingInfo, or
null
if the method
does not have a @RequestMapping
annotation. - See Also:
getCustomMethodCondition(Method)
,
getCustomTypeCondition(Class)
getCustomMethodCondition
protected RequestCondition<?> getCustomMethodCondition(java.lang.reflect.Method method)
- Provide a custom method-level request condition.
The custom
RequestCondition
can be of any type so long as the
same condition type is returned from all calls to this method in order
to ensure custom request conditions can be combined and compared.
- Parameters:
method
- the handler method for which to create the condition
- Returns:
- the condition, or
null
getCustomTypeCondition
protected RequestCondition<?> getCustomTypeCondition(java.lang.Class<?> handlerType)
- Provide a custom type-level request condition.
The custom
RequestCondition
can be of any type so long as the
same condition type is returned from all calls to this method in order
to ensure custom request conditions can be combined and compared.
- Parameters:
method
- the handler method for which to create the condition
- Returns:
- the condition, or
null
createRequestMappingInfo
private RequestMappingInfo createRequestMappingInfo(RequestMapping annotation,
RequestCondition<?> customCondition)
- Created a RequestMappingInfo from a RequestMapping annotation.