org.riotfamily.pages.mapping
Class SiteBeanNameHandlerMapping

java.lang.Object
  extended by org.springframework.context.support.ApplicationObjectSupport
      extended by org.springframework.web.context.support.WebApplicationObjectSupport
          extended by org.springframework.web.servlet.handler.AbstractHandlerMapping
              extended by org.riotfamily.common.web.mapping.AbstractReverseHandlerMapping
                  extended by org.riotfamily.common.web.mapping.AdvancedBeanNameHandlerMapping
                      extended by org.riotfamily.pages.mapping.SiteBeanNameHandlerMapping
All Implemented Interfaces:
ReverseHandlerMapping, ApplicationContextAware, Ordered, ServletContextAware, HandlerMapping

public class SiteBeanNameHandlerMapping
extends AdvancedBeanNameHandlerMapping

AdvancedBeanNameHandlerMapping that can fill in the path prefix of the current Site.

Lets assume you have a controller with the following mapping:

 <bean id="foo" name="${sitePrefix*}/foo.html" ... >
 
Then writing ${common.urlForHandler('foo')} in your .ftl will result in a valid URL, prefixed with the current Site's pathPrefix.

Note: The mapping currently doesn't perform any sanity check upon lookup, i.e. the pattern above will also match "/bar/baz/foo.html", even though "/bar/baz" is no valid Site prefix.

Author:
flx

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
SiteBeanNameHandlerMapping(PageResolver pageResolver)
           
 
Method Summary
protected  Map<String,?> getDefaults(UrlResolverContext context)
          Returns a Map of default values that are used to build URLs.
 Object getHandlerInternal(HttpServletRequest request)
          Look up a handler for the given request, falling back to the default handler if no specific one is found.
 
Methods inherited from class org.riotfamily.common.web.mapping.AdvancedBeanNameHandlerMapping
addServletMappingIfNecessary, getLookupPath, getPatternsForHandler, getRootHandler, initApplicationContext, isMapping, isStripServletMapping, lookupHandler, setLazyInitHandlers, setRootHandler, setStripServletMapping
 
Methods inherited from class org.riotfamily.common.web.mapping.AbstractReverseHandlerMapping
addServletMappingIfNecessary, exposeHandlerName, 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

SiteBeanNameHandlerMapping

public SiteBeanNameHandlerMapping(PageResolver pageResolver)
Method Detail

getHandlerInternal

public Object getHandlerInternal(HttpServletRequest request)
                          throws Exception
Description copied from class: AdvancedBeanNameHandlerMapping
Look up a handler for the given request, falling back to the default handler if no specific one is found.

Overrides:
getHandlerInternal in class AdvancedBeanNameHandlerMapping
Parameters:
request - current HTTP request
Returns:
the looked up handler instance, or the default handler
Throws:
Exception

getDefaults

protected Map<String,?> getDefaults(UrlResolverContext context)
Description copied from class: AbstractReverseHandlerMapping
Returns a Map of default values that are used to build URLs. The default implementation return null.

Overrides:
getDefaults in class AbstractReverseHandlerMapping