org.riotfamily.pages.mapping
Class PageResolver

java.lang.Object
  extended by org.riotfamily.pages.mapping.PageResolver

public class PageResolver
extends Object

Since:
7.0
Author:
Carsten Woelk [cwoelk at neteye dot de], Felix Gnass [fgnass at neteye dot de]

Field Summary
static String PAGE_ATTRIBUTE
           
static String PATH_ATTRIBUTE
           
static String SITE_ATTRIBUTE
           
 
Constructor Summary
PageResolver(PageDao pageDao, PathCompleter pathCompleter)
           
 
Method Summary
protected  void exposePathWithinSite(String pathWithinSite, HttpServletRequest request)
           
 Page getPage(HttpServletRequest request)
          Returns the Page for the given request.
 String getPathWithinSite(HttpServletRequest request)
          Returns the path within the resolved Site.
static Page getResolvedPage(HttpServletRequest request)
          Returns the previously resolved Page for the given request.
static Page getResolvedPage(UrlResolverContext context)
          Returns the previously resolved Page for the given context.
static String getResolvedPathWithinSite(HttpServletRequest request)
          Returns the previously resolved Path within the Site for the given request.
static String getResolvedPathWithinSite(UrlResolverContext context)
          Returns the previously resolved Path within the Site for the given context.
static Site getResolvedSite(HttpServletRequest request)
          Returns the previously resolved Site for the given request.
static Site getResolvedSite(UrlResolverContext context)
          Returns the previously resolved Site for the given context.
 Site getSite(HttpServletRequest request)
          Returns the first Site that matches the given request.
static void resetAttributes(HttpServletRequest request)
          Resets all internally used attributes.
 Page resolvePage(String url, String contextPath, Site fallbackSite)
          Returns the Page which is requestable at the given URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PATH_ATTRIBUTE

public static final String PATH_ATTRIBUTE

SITE_ATTRIBUTE

public static final String SITE_ATTRIBUTE

PAGE_ATTRIBUTE

public static final String PAGE_ATTRIBUTE
Constructor Detail

PageResolver

public PageResolver(PageDao pageDao,
                    PathCompleter pathCompleter)
Method Detail

getSite

public Site getSite(HttpServletRequest request)
Returns the first Site that matches the given request. The PathCompleter is used to strip the servlet mapping from the request URI.

Returns:
The first matching Site, or null if no match is found

getPathWithinSite

public String getPathWithinSite(HttpServletRequest request)
Returns the path within the resolved Site.


getPage

public Page getPage(HttpServletRequest request)
Returns the Page for the given request.


getResolvedPage

public static Page getResolvedPage(HttpServletRequest request)
Returns the previously resolved Page for the given request.

Note: This method does not perform any lookups itself. Only use this method if you are sure that getPage(HttpServletRequest) has been invoked before.


getResolvedPage

public static Page getResolvedPage(UrlResolverContext context)
Returns the previously resolved Page for the given context.

Note: This method does not perform any lookups itself. Only use this method if you are sure that getPage(HttpServletRequest) has been invoked before.


getResolvedSite

public static Site getResolvedSite(HttpServletRequest request)
Returns the previously resolved Site for the given request.

Note: This method does not perform any lookups itself. Only use this method if you are sure that getSite(HttpServletRequest) has been invoked before.


getResolvedSite

public static Site getResolvedSite(UrlResolverContext context)
Returns the previously resolved Site for the given context.

Note: This method does not perform any lookups itself. Only use this method if you are sure that getSite(HttpServletRequest) has been invoked before.


getResolvedPathWithinSite

public static String getResolvedPathWithinSite(HttpServletRequest request)
Returns the previously resolved Path within the Site for the given request.

Note: This method does not perform any lookups itself. Only use this method if you are sure that getSite(HttpServletRequest) has been invoked before.


getResolvedPathWithinSite

public static String getResolvedPathWithinSite(UrlResolverContext context)
Returns the previously resolved Path within the Site for the given context.

Note: This method does not perform any lookups itself. Only use this method if you are sure that getSite(HttpServletRequest) has been invoked before.


resolvePage

public Page resolvePage(String url,
                        String contextPath,
                        Site fallbackSite)
Returns the Page which is requestable at the given URL. This may return null in case the given parameters do not match a page.

Parameters:
url - url of the requestable page
contextPath - of the application in order to strip it
fallbackSite - in case the site can't be looked up, this site will be used to find the page
pathCompleter - in order to strip the servlet mapping
Returns:
the page matching the parameters or null if no page was found

exposePathWithinSite

protected void exposePathWithinSite(String pathWithinSite,
                                    HttpServletRequest request)

resetAttributes

public static void resetAttributes(HttpServletRequest request)
Resets all internally used attributes.

Parameters:
request -