spring MVC 可以根据URL获取所有匹配的Controller吗?
如:/hello --> ***.HelloController
spring MVC 可以根据URL获取所有匹配的Controller吗?
如:/hello --> ***.HelloController
AbstractUrlHandlerMapping
lookupHandler
protected Object lookupHandler(String urlPath,
HttpServletRequest request)
throws Exception
Look up a handler instance for the given URL path.
Supports direct matches, e.g. a registered "/test" matches "/test", and various Ant-style pattern matches, e.g. a registered "/t*" matches both "/test" and "/team". For details, see the AntPathMatcher class.
Looks for the most exact pattern, where most exact is defined as the longest path pattern.
Parameters:
urlPath - URL the bean is mapped to
request - current HTTP request (to expose the path within the mapping to)
Returns:
the associated handler instance, or null if not found
Throws:
Exception
getHandlerMap
public final Map getHandlerMap()
Return the registered handlers as an unmodifiable Map, with the registered path as key and the handler object (or handler bean name in case of a lazy-init handler) as value.
See Also:
AbstractHandlerMapping.getDefaultHandler()