com.arsdigita.cms.dispatcher
Class CategoryItemResolverImpl

java.lang.Object
  extended bycom.arsdigita.cms.dispatcher.AbstractItemResolver
      extended bycom.arsdigita.cms.dispatcher.MultilingualItemResolver
          extended bycom.arsdigita.cms.dispatcher.CategoryItemResolverImpl
All Implemented Interfaces:
CategoryItemResolver, ItemResolver, TemplateResolver

public class CategoryItemResolverImpl
extends MultilingualItemResolver
implements CategoryItemResolver, TemplateResolver

Resolves items to URLs and URLs to items with category-based URLs for multiple language variants. Created Mon Jan 20 14:30:03 2003.

Version:
$Id: //cms/dev/src/com/arsdigita/cms/dispatcher/CategoryItemResolverImpl.java#13 $
Author:
Scott Seago

Nested Class Summary
protected  class CategoryItemResolverImpl.CategoryTemplateResolver
           
 
Field Summary
static String CATEGORIES_PREFIX
           
 
Fields inherited from class com.arsdigita.cms.dispatcher.MultilingualItemResolver
ITEM_ID, SEPARATOR, versionId
 
Fields inherited from class com.arsdigita.cms.dispatcher.AbstractItemResolver
TEMPLATE_CONTEXT_PREFIX
 
Fields inherited from interface com.arsdigita.cms.dispatcher.ItemResolver
versionId
 
Fields inherited from interface com.arsdigita.cms.dispatcher.TemplateResolver
versionId
 
Constructor Summary
CategoryItemResolverImpl()
           
 
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, com.arsdigita.categorization.Category category)
          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, BigDecimal itemId, String name, ContentSection section, String context, String templateContext, com.arsdigita.categorization.Category category)
          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, com.arsdigita.categorization.Category category)
          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 generateItemURL(com.arsdigita.bebop.PageState state, ContentItem item, ContentSection section, String context, String templateContext, com.arsdigita.categorization.Category category)
          Generates a URL for a content item.
protected  String generateLiveURL(ContentSection section, ContentItem item, String templateContext, com.arsdigita.categorization.Category category)
          Generate a language-independent URL to the item in the given section.
protected  String generatePreviewURL(ContentSection section, ContentItem item, String templateContext, com.arsdigita.categorization.Category category)
          Generate a URL which can be used to preview the item, using the given templateContext.
 com.arsdigita.categorization.Category getCategory(javax.servlet.http.HttpServletRequest request)
          Gets the category for the current request (if set by getItem(section, url, context)
 com.arsdigita.categorization.Category[] getCategoryPath(javax.servlet.http.HttpServletRequest request)
          Gets the category path for the current request (if set by getItem(section, url, context)
 ContentItem getItem(ContentSection section, String url, String context)
          Returns a content item based on section, url, and use context.
 String getTemplate(ContentSection section, ContentItem item, javax.servlet.http.HttpServletRequest request)
          Returns the JSP template filename relative to the webapp root.
 String getTemplateContext(javax.servlet.http.HttpServletRequest request)
          Gets the template context from the request.
 String getTemplatePath(Template template)
          Returns the JSP template filename relative to the webapp root for a given Template reference.
 String getTemplateXSLPath(Template template)
          Returns the XSL template filename relative to the webapp root for a given Template reference.
 boolean isIndexRequest(javax.servlet.http.HttpServletRequest request)
          Whether the current request is an index item request (i.e.
 void setTemplateContext(String sTemplateContext, javax.servlet.http.HttpServletRequest request)
          Sets the TemplateContext parameter in the request
 
Methods inherited from class com.arsdigita.cms.dispatcher.MultilingualItemResolver
generateDraftURL, generateLiveURL, generatePreviewURL, getCurrentContext, getItemFromDraftURL, getItemFromLangAndBundle, getItemFromLiveURL, getMasterPage, getNameAndLangFromURLFrag
 
Methods inherited from class com.arsdigita.cms.dispatcher.AbstractItemResolver
getTemplateFromURL, stripTemplateFromURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.arsdigita.cms.dispatcher.ItemResolver
getCurrentContext, getMasterPage, getTemplateFromURL, stripTemplateFromURL
 

Field Detail

CATEGORIES_PREFIX

public static final String CATEGORIES_PREFIX
See Also:
Constant Field Values
Constructor Detail

CategoryItemResolverImpl

public CategoryItemResolverImpl()
Method Detail

getCategory

public com.arsdigita.categorization.Category getCategory(javax.servlet.http.HttpServletRequest request)
Gets the category for the current request (if set by getItem(section, url, context)

Specified by:
getCategory in interface CategoryItemResolver
Parameters:
request - The current request
Returns:
the Category for the current request

getCategoryPath

public com.arsdigita.categorization.Category[] getCategoryPath(javax.servlet.http.HttpServletRequest request)
Gets the category path for the current request (if set by getItem(section, url, context)

Specified by:
getCategoryPath in interface CategoryItemResolver
Parameters:
request - The current request
Returns:
the Category path for the current request

isIndexRequest

public boolean isIndexRequest(javax.servlet.http.HttpServletRequest request)
Whether the current request is an index item request (i.e. the item name is not specified in the URL)

Specified by:
isIndexRequest in interface CategoryItemResolver
Parameters:
request - The current request
Returns:
Whether the current request is an index item request

getItem

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

Specified by:
getItem in interface ItemResolver
Overrides:
getItem in class MultilingualItemResolver
Parameters:
section - The current content section
url - The section-relative URL
context - The use context, e.g. ContentItem.LIVE, CMSDispatcher.PREVIEW or ContentItem.DRAFT. See MultilingualItemResolver.getCurrentContext(com.arsdigita.bebop.PageState).
Returns:
The content item, or null if no such item exists

generateItemURL

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

Specified by:
generateItemURL in interface CategoryItemResolver
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"
category - the Category to use as the context for generating the URL
Returns:
The URL of the item
See Also:
MultilingualItemResolver.getCurrentContext(com.arsdigita.bebop.PageState)

generateItemURL

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

Specified by:
generateItemURL in interface CategoryItemResolver
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"
category - the Category to use as the context for
Returns:
The URL of the item
See Also:
MultilingualItemResolver.getCurrentContext(com.arsdigita.bebop.PageState)

generateItemURL

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

Specified by:
generateItemURL in interface CategoryItemResolver
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"
category - the Category to use as the context for
Returns:
The URL of the item
See Also:
MultilingualItemResolver.getCurrentContext(com.arsdigita.bebop.PageState)

generateItemURL

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

Specified by:
generateItemURL in interface CategoryItemResolver
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"
category - the Category to use as the context for
Returns:
The URL of the item
See Also:
MultilingualItemResolver.getCurrentContext(com.arsdigita.bebop.PageState)

generateItemURL

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

Specified by:
generateItemURL in interface ItemResolver
Overrides:
generateItemURL in class MultilingualItemResolver
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:
MultilingualItemResolver.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.

Specified by:
generateItemURL in interface ItemResolver
Overrides:
generateItemURL in class MultilingualItemResolver
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:
MultilingualItemResolver.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.

Specified by:
generateItemURL in interface ItemResolver
Overrides:
generateItemURL in class MultilingualItemResolver
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:
MultilingualItemResolver.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.

Specified by:
generateItemURL in interface ItemResolver
Overrides:
generateItemURL in class MultilingualItemResolver
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:
MultilingualItemResolver.getCurrentContext(com.arsdigita.bebop.PageState)

generateLiveURL

protected String generateLiveURL(ContentSection section,
                                 ContentItem item,
                                 String templateContext,
                                 com.arsdigita.categorization.Category category)
Generate a language-independent URL to the item in the given section.

When a client retrieves this URL, the URL is resolved to point to a specific language instance of the item referenced here, i.e. this URL will be resolved to a language-specific URL internally.

Parameters:
section - the ContentSection that contains this item
item - ContentItem for which a URL should be constructed.
templateContext - template context; will be ignored if null
category - the Category to use for URL generation
Returns:
a language-independent URL to the item in the given section, which will be presented within the given templateContext

generatePreviewURL

protected String generatePreviewURL(ContentSection section,
                                    ContentItem item,
                                    String templateContext,
                                    com.arsdigita.categorization.Category category)
Generate a URL which can be used to preview the item, using the given templateContext.

Only a specific language instance can be previewed, meaning there no language negotiation is involved when a request is made to a URL that has been generated by this method.

Parameters:
section - The ContentSection which contains the item
item - The ContentItem for which a URL should be generated.
templateContext - the context that determines which template should render the item when it is previewed; ignored if the argument given here is null
category - the Category to use for URL generation
Returns:
a URL which can be used to preview the given item

getTemplate

public String getTemplate(ContentSection section,
                          ContentItem item,
                          javax.servlet.http.HttpServletRequest request)
Description copied from interface: TemplateResolver
Returns the JSP template filename relative to the webapp root.

Specified by:
getTemplate in interface TemplateResolver
Parameters:
section - The ContentSection for the request
item - The ContentItem for the request
request - The current HttpServletRequest
Returns:
The path to the jsp template.

getTemplateXSLPath

public String getTemplateXSLPath(Template template)
Description copied from interface: TemplateResolver
Returns the XSL template filename relative to the webapp root for a given Template reference.

Specified by:
getTemplateXSLPath in interface TemplateResolver
Parameters:
template - The Template to resolve the URL for.
Returns:
The path to the xsl template.

getTemplatePath

public String getTemplatePath(Template template)
Description copied from interface: TemplateResolver
Returns the JSP template filename relative to the webapp root for a given Template reference.

Specified by:
getTemplatePath in interface TemplateResolver
Parameters:
template - The Template to resolve the URL for.
Returns:
The path to the jsp template.

setTemplateContext

public void setTemplateContext(String sTemplateContext,
                               javax.servlet.http.HttpServletRequest request)
Description copied from interface: TemplateResolver
Sets the TemplateContext parameter in the request

Specified by:
setTemplateContext in interface TemplateResolver
Parameters:
sTemplateContext - the template context to set
request - the request in which to set the template context

getTemplateContext

public String getTemplateContext(javax.servlet.http.HttpServletRequest request)
Description copied from interface: TemplateResolver
Gets the template context from the request.

Specified by:
getTemplateContext in interface TemplateResolver
Parameters:
request - the request from which to get the template context
Returns:
the template context


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