|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.handler.AbstractHandlerMapping
org.riotfamily.common.web.mapping.AbstractReverseHandlerMapping
org.riotfamily.common.web.mapping.AdvancedBeanNameHandlerMapping
public class AdvancedBeanNameHandlerMapping
HandlerMapping that works like Spring's BeanNameUrlHandlerMapping and can expose parts of the matched URL as request attributes.
The handler name /foo/bar/@{some}/@{value}
would be
equivalent to /foo/bar/*/*
, the last two wildcards
would be exposed as attributes "some" and "value".
Field Summary |
---|
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
logger |
Fields inherited from interface org.riotfamily.common.web.mapping.ReverseHandlerMapping |
---|
TOP_LEVEL_HANDLER_NAME_ATTRIBUTE |
Fields inherited from interface org.springframework.web.servlet.HandlerMapping |
---|
PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE |
Fields inherited from interface org.springframework.core.Ordered |
---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
Constructor Summary | |
---|---|
AdvancedBeanNameHandlerMapping()
|
Method Summary | |
---|---|
protected String |
addServletMappingIfNecessary(String path,
HttpServletRequest request)
|
Object |
getHandlerInternal(HttpServletRequest request)
Look up a handler for the given request, falling back to the default handler if no specific one is found. |
protected String |
getLookupPath(HttpServletRequest request)
|
protected List<AttributePattern> |
getPatternsForHandler(String beanName,
UrlResolverContext context)
Subclasses must implement this method and return all patterns for the handler with the specified
name. |
protected Object |
getRootHandler()
Return the root handler for this handler mapping (registered for "/"), or null if none. |
void |
initApplicationContext()
Copied from BeanNameUrlHandlerMapping |
protected boolean |
isMapping(String beanName)
|
protected boolean |
isStripServletMapping()
|
protected Object |
lookupHandler(String urlPath,
HttpServletRequest request)
Look up a handler instance for the given URL path. |
void |
setLazyInitHandlers(boolean lazyInitHandlers)
Set whether to lazily initialize handlers. |
void |
setRootHandler(Object rootHandler)
Set the root handler for this handler mapping, that is, the handler to be registered for the root path ("/"). |
void |
setStripServletMapping(boolean stripServletMapping)
|
Methods inherited from class org.riotfamily.common.web.mapping.AbstractReverseHandlerMapping |
---|
addServletMappingIfNecessary, exposeHandlerName, getDefaults, getPatternForHandler, getPatternForHandler, getPatternsForHandler, getUrlForHandler, getUrlForHandler, getWildcardAttributes |
Methods inherited from class org.springframework.web.servlet.handler.AbstractHandlerMapping |
---|
adaptInterceptor, extendInterceptors, getAdaptedInterceptors, getDefaultHandler, getHandler, getHandlerExecutionChain, getOrder, initInterceptors, setDefaultHandler, setInterceptors, setOrder |
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
---|
getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext |
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AdvancedBeanNameHandlerMapping()
Method Detail |
---|
public final void setStripServletMapping(boolean stripServletMapping)
protected final boolean isStripServletMapping()
public final void setRootHandler(Object rootHandler)
Default is null
, indicating no root handler.
protected final Object getRootHandler()
null
if none.
public void setLazyInitHandlers(boolean lazyInitHandlers)
If you want to allow your controllers to be lazily initialized, make them "lazy-init" and set this flag to true. Just making them "lazy-init" will not work, as they are initialized through the references from the handler mapping in this case.
public void initApplicationContext() throws ApplicationContextException
initApplicationContext
in class AbstractHandlerMapping
ApplicationContextException
protected boolean isMapping(String beanName)
protected String getLookupPath(HttpServletRequest request)
public Object getHandlerInternal(HttpServletRequest request) throws Exception
getHandlerInternal
in class AbstractHandlerMapping
request
- current HTTP request
Exception
protected Object lookupHandler(String urlPath, HttpServletRequest request)
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.
Copied from AbstractUrlHandlerMapping
urlPath
- URL the bean is mapped to
null
if not foundAntPathMatcher
protected String addServletMappingIfNecessary(String path, HttpServletRequest request)
protected List<AttributePattern> getPatternsForHandler(String beanName, UrlResolverContext context)
AbstractReverseHandlerMapping
patterns
for the handler with the specified
name.
getPatternsForHandler
in class AbstractReverseHandlerMapping
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |