org.opencms.loader
Interface I_CmsTemplateContextProvider

All Known Implementing Classes:
CmsDefaultTemplateContextProvider

public interface I_CmsTemplateContextProvider

Interface for template context providers.

Implementations of this class are used to dynamically determine a template used for rendering a page at runtime, e.g. there could be one template for desktop browsers and another for mobile browsers. It is possible to override the template using a cookie containing the name of the template context which should be used as a value. The cookie name is determined by the template context provider.


Method Summary
 java.util.Map<java.lang.String,CmsTemplateContext> getAllContexts()
          Gets a map of all template contexts, with the template context names as keys.
 java.lang.String getEditorStyleSheet(CmsObject cms, java.lang.String editedResourcePath)
          Returns the style sheet to be used for the editor.
 java.lang.String getOverrideCookieName()
          Gets the name of the cookie which should be used for overriding the template context.
 CmsTemplateContext getTemplateContext(CmsObject cms, javax.servlet.http.HttpServletRequest request, CmsResource resource)
          Determines the template context from the current CMS context, request, and resource.
 void initialize(CmsObject cms)
          Initializes the context provider using a CMS object.
 

Method Detail

getAllContexts

java.util.Map<java.lang.String,CmsTemplateContext> getAllContexts()
Gets a map of all template contexts, with the template context names as keys.

Returns:
the map of template context providers

getEditorStyleSheet

java.lang.String getEditorStyleSheet(CmsObject cms,
                                     java.lang.String editedResourcePath)
Returns the style sheet to be used for the editor.

Parameters:
cms - the current CMS context
editedResourcePath - the path of the edited resource
Returns:
the path of the style sheet to be used for the resource

getOverrideCookieName

java.lang.String getOverrideCookieName()
Gets the name of the cookie which should be used for overriding the template context.

Returns:
the name of the cookie used for overriding the template context

getTemplateContext

CmsTemplateContext getTemplateContext(CmsObject cms,
                                      javax.servlet.http.HttpServletRequest request,
                                      CmsResource resource)
Determines the template context from the current CMS context, request, and resource.

Parameters:
cms - the CMS context
request - the current request
resource - the resource being rendered
Returns:
the current template context

initialize

void initialize(CmsObject cms)
Initializes the context provider using a CMS object.

Parameters:
cms - the current CMS context