public class DynamicUrlHandlerMapping
extends org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
implements org.springframework.core.PriorityOrdered
Constructor and Description |
---|
DynamicUrlHandlerMapping() |
Modifier and Type | Method and Description |
---|---|
protected Object |
lookupHandler(String urlPath,
javax.servlet.http.HttpServletRequest request)
Look up a handler instance for the given URL path.
|
void |
registerController(org.springframework.web.servlet.mvc.Controller controller,
List<String> urlPatterns) |
protected void |
registerDefaultHandler(String urlPath,
org.springframework.web.servlet.mvc.Controller handler)
Register the specified handler for the given URL path.
|
void |
reloadHandlerMap()
reloades the merged url map
|
void |
unregisterController(org.springframework.web.servlet.mvc.Controller controller)
Unregister all handlers specified in the URL map for the corresponding plugin.
|
buildPathExposingHandler, exposePathWithinMapping, exposeUriTemplateVariables, getHandlerInternal, getHandlerMap, getRootHandler, registerHandler, registerHandler, setLazyInitHandlers, setRootHandler, supportsTypeLevelMappings, validateHandler
adaptInterceptor, detectMappedInterceptors, extendInterceptors, getAdaptedInterceptors, getDefaultHandler, getHandler, getHandlerExecutionChain, getMappedInterceptors, getOrder, getPathMatcher, getUrlPathHelper, initApplicationContext, initInterceptors, setAlwaysUseFullPath, setDefaultHandler, setInterceptors, setOrder, setPathMatcher, setRemoveSemicolonContent, setUrlDecode, setUrlPathHelper
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext
protected Object lookupHandler(String urlPath, javax.servlet.http.HttpServletRequest request) throws Exception
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.
lookupHandler
in class org.springframework.web.servlet.handler.AbstractUrlHandlerMapping
urlPath
- URL the bean is mapped torequest
- current HTTP request (to expose the path within the mapping to)null
if not foundException
- in case of an errorAbstractUrlHandlerMapping.exposePathWithinMapping(java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest)
,
AntPathMatcher
public void registerController(org.springframework.web.servlet.mvc.Controller controller, List<String> urlPatterns)
controller
- the controllerurlPatterns
- the url patterns of the controllerprotected void registerDefaultHandler(String urlPath, org.springframework.web.servlet.mvc.Controller handler) throws org.springframework.beans.BeansException, IllegalStateException
urlPath
- the URL the bean should be mapped tohandler
- the handler instance or handler bean name String (a bean name will automatically
be resolved into the corresponding handler bean)org.springframework.beans.BeansException
- if the handler couldn't be registeredIllegalStateException
- if there is a conflicting handler registeredpublic void reloadHandlerMap()
public void unregisterController(org.springframework.web.servlet.mvc.Controller controller)
controller
- the controllerCopyright © 2019 Communote team. All rights reserved.