org.springframework.web.servlet.handler
public class: BeanNameUrlHandlerMapping [javadoc |
source]
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.AbstractUrlHandlerMapping
org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping
org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping
All Implemented Interfaces:
HandlerMapping, Ordered, ServletContextAware, ApplicationContextAware
Implementation of the
org.springframework.web.servlet.HandlerMapping
interface that map from URLs to beans with names that start with a slash ("/"),
similar to how Struts maps URLs to action names.
This is the default implementation used by the
org.springframework.web.servlet.DispatcherServlet , along with
org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping
(on Java 5 and higher). Alternatively, SimpleUrlHandlerMapping allows for
customizing a handler mapping declaratively.
The mapping is from URL to bean name. Thus an incoming URL "/foo" would map
to a handler named "/foo", or to "/foo /foo2" in case of multiple mappings to
a single handler. Note: In XML definitions, you'll need to use an alias
name="/foo" in the bean definition, as the XML id may not contain slashes.
Supports direct matches (given "/test" -> registered "/test") and "*"
matches (given "/test" -> registered "/t*"). Note that the default is
to map within the current servlet mapping if applicable; see the
"alwaysUseFullPath" property for details.
For details on the pattern options, see the
org.springframework.util.AntPathMatcher javadoc.
| Methods from org.springframework.web.servlet.handler.AbstractUrlHandlerMapping: |
|---|
|
buildPathExposingHandler, exposePathWithinMapping, getHandlerInternal, getHandlerMap, getPathMatcher, getRootHandler, lookupHandler, registerHandler, registerHandler, setAlwaysUseFullPath, setLazyInitHandlers, setPathMatcher, setRootHandler, setUrlDecode, setUrlPathHelper, validateHandler |
| Methods from org.springframework.web.servlet.handler.AbstractHandlerMapping: |
|---|
|
adaptInterceptor, extendInterceptors, getAdaptedInterceptors, getDefaultHandler, getHandler, getHandlerExecutionChain, getHandlerInternal, getOrder, initApplicationContext, initInterceptors, setDefaultHandler, setInterceptors, setOrder |
| Method from org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping Detail: |
protected String[] determineUrlsForHandler(String beanName) {
List urls = new ArrayList();
if (beanName.startsWith("/")) {
urls.add(beanName);
}
String[] aliases = getApplicationContext().getAliases(beanName);
for (int i = 0; i < aliases.length; i++) {
if (aliases[i].startsWith("/")) {
urls.add(aliases[i]);
}
}
return StringUtils.toStringArray(urls);
}
Checks name and aliases of the given bean for URLs, starting with "/". |