com.arsdigita.cms.dispatcher
Interface ItemResolver

All Known Subinterfaces:
CategoryItemResolver
All Known Implementing Classes:
AbstractItemResolver, CategoryItemResolverImpl, MultilingualItemResolver, SimpleItemResolver

public interface ItemResolver

The ItemResolver is responsible for mapping a URL in a particular content section to a content item.

As an example, here is the item resolution process for a request to http://yourserver/cms/cheese:

The item resolver would be asked to map the URL stub /cheese in the content section mounted at /cms to a content item. To this end, the dispatcher calls the getItem method, passing in the ContentSection and the URL stub for the item within the section, /cheese in our example. As a final argument, the dispatcher passes either ContentItem.DRAFT or ContentItem.LIVE to the ItemResolver, depending on whether the returned item should be the live version (for public pages) or the draft version (for previewing).

Version:
$Revision: #9 $ $DateTime: 2004/04/07 16:07:11 $
Author:
Michael Pih (pihman@arsdigita.com), Stanislav Freidin (sfreidin@arsdigita.com)

Field Summary
static String versionId
           
 
Method Summary
 String generateItemURL(com.arsdigita.bebop.PageState state, BigDecimal itemId, String name, ContentSection section, String context)
          Generates a URL for a content item.
 String generateItemURL(com.arsdigita.bebop.PageState state, BigDecimal itemId, String name, ContentSection section, String context, String templateContext)
          Generates a URL for a content item.
 String generateItemURL(com.arsdigita.bebop.PageState state, ContentItem item, ContentSection section, String context)
          Generates a URL for a content item.
 String generateItemURL(com.arsdigita.bebop.PageState state, ContentItem item, ContentSection section, String context, String templateContext)
          Generates a URL for a content item.
 String getCurrentContext(com.arsdigita.bebop.PageState state)
          Fetches the current context based on the page state.
 ContentItem getItem(ContentSection section, String url, String context)
          Return a content item based on section, url, and use context.
 CMSPage getMasterPage(ContentItem item, javax.servlet.http.HttpServletRequest request)
          Return a master page based on page state (and content section).
 String getTemplateFromURL(String inUrl)
          Finds the template context from the URL and returns it, if it is there.
 String stripTemplateFromURL(String inUrl)
          Removes the template context from the inUrl.
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Method Detail

getItem

public ContentItem getItem(ContentSection section,
                           String url,
                           String context)
Return a content item based on section, url, and use context.

Parameters:
section - The current content section
url - The section-relative URL
context - The use context
Returns:
The content item, or null if no such item exists

getCurrentContext

public String getCurrentContext(com.arsdigita.bebop.PageState state)
Fetches the current context based on the page state.

Parameters:
state - the current page state
Returns:
the context of the current URL, such as "live" or "admin"

generateItemURL

public String generateItemURL(com.arsdigita.bebop.PageState state,
                              BigDecimal itemId,
                              String name,
                              ContentSection section,
                              String context)
Generates a URL for a content item.

Parameters:
itemId - The item ID
name - The name of the content page
state - The page state
section - the content section to which the item belongs
context - the context of the URL, such as "live" or "admin"
Returns:
The URL of the item
See Also:
getCurrentContext(com.arsdigita.bebop.PageState)

generateItemURL

public String generateItemURL(com.arsdigita.bebop.PageState state,
                              BigDecimal itemId,
                              String name,
                              ContentSection section,
                              String context,
                              String templateContext)
Generates a URL for a content item.

Parameters:
itemId - The item ID
name - The name of the content page
state - The page state
section - the content section to which the item belongs
context - the context of the URL, such as "live" or "admin"
templateContext - the context for the URL, such as "public"
Returns:
The URL of the item
See Also:
getCurrentContext(com.arsdigita.bebop.PageState)

generateItemURL

public String generateItemURL(com.arsdigita.bebop.PageState state,
                              ContentItem item,
                              ContentSection section,
                              String context)
Generates a URL for a content item.

Parameters:
item - The item
state - The page state
section - the content section to which the item belongs
context - the context of the URL, such as "live" or "admin"
Returns:
The URL of the item
See Also:
getCurrentContext(com.arsdigita.bebop.PageState)

generateItemURL

public String generateItemURL(com.arsdigita.bebop.PageState state,
                              ContentItem item,
                              ContentSection section,
                              String context,
                              String templateContext)
Generates a URL for a content item.

Parameters:
item - The item
state - The page state
section - the content section to which the item belongs
context - the context of the URL, such as "live" or "admin"
templateContext - the context for the URL, such as "public"
Returns:
The URL of the item
See Also:
getCurrentContext(com.arsdigita.bebop.PageState)

getMasterPage

public CMSPage getMasterPage(ContentItem item,
                             javax.servlet.http.HttpServletRequest request)
                      throws javax.servlet.ServletException
Return a master page based on page state (and content section).

Parameters:
item - The content item
request - The HTTP request
Returns:
The master page
Throws:
javax.servlet.ServletException

getTemplateFromURL

public String getTemplateFromURL(String inUrl)
Finds the template context from the URL and returns it, if it is there. Otherwise, returns null.

Parameters:
inUrl - the URL from which to get the template context
Returns:
the template context, or null if there is no template context

stripTemplateFromURL

public String stripTemplateFromURL(String inUrl)
Removes the template context from the inUrl.

Parameters:
inUrl - URL, possibly including the template context.
Returns:
inUrl with the template context removed


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 21 2004:2352 UTC