|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.cms.dispatcher.AbstractItemResolver
com.arsdigita.cms.dispatcher.MultilingualItemResolver
Resolves items to URLs and URLs to items for multiple language variants. Created Mon Jan 20 14:30:03 2003.
Field Summary | |
protected static String |
ITEM_ID
The string identifying an item's ID in the query string of a URL. |
protected static String |
SEPARATOR
The separator used in URL query strings; should be either "&" or ";". |
static String |
versionId
|
Fields inherited from class com.arsdigita.cms.dispatcher.AbstractItemResolver |
TEMPLATE_CONTEXT_PREFIX |
Constructor Summary | |
MultilingualItemResolver()
|
Method Summary | |
protected String |
generateDraftURL(ContentSection section,
BigDecimal itemId)
Returns content item's draft version URL |
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. |
protected String |
generateLiveURL(ContentSection section,
ContentItem item,
String templateContext)
Generate a language-independent URL to the item in the given section. |
protected String |
generatePreviewURL(ContentSection section,
ContentItem item,
String templateContext)
Generate a URL which can be used to preview the item , using the given
templateContext . |
String |
getCurrentContext(com.arsdigita.bebop.PageState state)
Fetches the current context based on the page state. |
ContentItem |
getItem(ContentSection section,
String url,
String context)
Returns a content item based on section, url, and use context. |
protected ContentItem |
getItemFromDraftURL(String url)
Retrieves ITEM_ID parameter from URL and
instantiates item according to this ID. |
protected ContentItem |
getItemFromLangAndBundle(String lang,
ContentItem item)
Finds a language instance of a content item given the bundle, name, and lang string |
protected ContentItem |
getItemFromLiveURL(String url,
Folder parentFolder)
Returns a content item based on URL relative to the root folder. |
CMSPage |
getMasterPage(ContentItem item,
javax.servlet.http.HttpServletRequest request)
Returns a master page based on page state (and content section). |
protected String[] |
getNameAndLangFromURLFrag(String url)
Returns an array containing the the item's name and lang based on the URL fragment. |
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 |
getTemplateFromURL, stripTemplateFromURL |
Field Detail |
public static final String versionId
protected static final String ITEM_ID
protected static final String SEPARATOR
Constructor Detail |
public MultilingualItemResolver()
Method Detail |
public ContentItem getItem(ContentSection section, String url, String context)
getItem
in interface ItemResolver
getItem
in class AbstractItemResolver
section
- The current content sectionurl
- The section-relative URLcontext
- The use context,
e.g. ContentItem.LIVE
,
CMSDispatcher.PREVIEW
or
ContentItem.DRAFT
. See getCurrentContext(com.arsdigita.bebop.PageState)
.
public String getCurrentContext(com.arsdigita.bebop.PageState state)
getCurrentContext
in interface ItemResolver
getCurrentContext
in class AbstractItemResolver
state
- the current page state
ContentItem.LIVE
or ContentItem.DRAFT
ContentItem.LIVE
,
ContentItem.DRAFT
public String generateItemURL(com.arsdigita.bebop.PageState state, BigDecimal itemId, String name, ContentSection section, String context)
generateItemURL
in interface ItemResolver
generateItemURL
in class AbstractItemResolver
itemId
- The item IDname
- The name of the content pagestate
- The page statesection
- the content section to which the item belongscontext
- the context of the URL, such as "live" or
"admin"
getCurrentContext(com.arsdigita.bebop.PageState)
public String generateItemURL(com.arsdigita.bebop.PageState state, BigDecimal itemId, String name, ContentSection section, String context, String templateContext)
generateItemURL
in interface ItemResolver
generateItemURL
in class AbstractItemResolver
itemId
- The item IDname
- The name of the content pagestate
- The page statesection
- the content section to which the item belongscontext
- the context of the URL, such as "live" or
"admin"templateContext
- the context for the URL, such as
"public"
getCurrentContext(com.arsdigita.bebop.PageState)
public String generateItemURL(com.arsdigita.bebop.PageState state, ContentItem item, ContentSection section, String context)
generateItemURL
in interface ItemResolver
generateItemURL
in class AbstractItemResolver
item
- The itemstate
- The page statesection
- the content section to which the item belongscontext
- the context of the URL, such as "live" or
"admin"
getCurrentContext(com.arsdigita.bebop.PageState)
public String generateItemURL(com.arsdigita.bebop.PageState state, ContentItem item, ContentSection section, String context, String templateContext)
generateItemURL
in interface ItemResolver
generateItemURL
in class AbstractItemResolver
item
- The itemstate
- The page statesection
- the content section to which the item belongscontext
- the context of the URL, such as "live" or
"admin"templateContext
- the context for the URL, such as
"public"
getCurrentContext(com.arsdigita.bebop.PageState)
public CMSPage getMasterPage(ContentItem item, javax.servlet.http.HttpServletRequest request) throws javax.servlet.ServletException
getMasterPage
in interface ItemResolver
getMasterPage
in class AbstractItemResolver
item
- The content itemrequest
- The HTTP request
javax.servlet.ServletException
protected String generateDraftURL(ContentSection section, BigDecimal itemId)
section
- The content section to which the item belongsitemId
- The content item's ID
protected String generateLiveURL(ContentSection section, ContentItem item, String templateContext)
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.
section
- the ContentSection
that contains this itemitem
- ContentItem
for which a URL should be
constructed.templateContext
- template context; will be ignored if null
item
in the given section
, which will
be presented within the given templateContext
protected String generatePreviewURL(ContentSection section, ContentItem item, String templateContext)
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.
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
item
protected ContentItem getItemFromDraftURL(String url)
ITEM_ID
parameter from URL and
instantiates item according to this ID.
url
- URL that indicates which item should be retrieved;
must contain the ITEM_ID
parameter
ContentItem
the given url
points to, or null
if no ID has been found in the
url
protected ContentItem getItemFromLiveURL(String url, Folder parentFolder)
url
- The content item urlparentFolder
- The parent folder object, url must be relevant to it
protected String[] getNameAndLangFromURLFrag(String url)
protected ContentItem getItemFromLangAndBundle(String lang, ContentItem item)
lang
- The lang string from the URLitem
- The content bundle
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |