public class CmsDefaultTemplateContextProvider extends java.lang.Object implements I_CmsTemplateContextProvider
The template JSP paths are read from a VFS file "/system/shared/templatecontexts.json"
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
A_HEIGHT
JSON attribute name.
|
static java.lang.String |
A_NICE_NAME
JSON attribute name.
|
static java.lang.String |
A_PATH
JSON attribute name.
|
static java.lang.String |
A_VARIANTS
JSON attribute name.
|
static java.lang.String |
A_WIDTH
JSON attribute name.
|
static java.lang.String |
PARAM_CONFIGURATION
The name for the configuration parameter which points to the template contexts configuration file.
|
构造器和说明 |
---|
CmsDefaultTemplateContextProvider()
Default constructor.
|
限定符和类型 | 方法和说明 |
---|---|
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 |
getConfigurationPropertyPath()
Returns the absolute VFS path where the configuration property file is stored.
|
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,
java.lang.String config)
Initializes the context provider using a CMS object.
|
java.lang.String |
readCommonProperty(CmsObject cms,
java.lang.String propertyName,
java.lang.String fallbackValue)
Gets the value which should be used instead of a property which was read from the template resource.
|
public static final java.lang.String A_HEIGHT
public static final java.lang.String A_NICE_NAME
public static final java.lang.String A_PATH
public static final java.lang.String A_VARIANTS
public static final java.lang.String A_WIDTH
public static final java.lang.String PARAM_CONFIGURATION
public CmsDefaultTemplateContextProvider()
public java.util.Map<java.lang.String,CmsTemplateContext> getAllContexts()
I_CmsTemplateContextProvider
getAllContexts
在接口中 I_CmsTemplateContextProvider
I_CmsTemplateContextProvider.getAllContexts()
public java.lang.String getConfigurationPropertyPath()
public java.lang.String getEditorStyleSheet(CmsObject cms, java.lang.String editedResourcePath)
I_CmsTemplateContextProvider
getEditorStyleSheet
在接口中 I_CmsTemplateContextProvider
cms
- the current CMS contexteditedResourcePath
- the path of the edited resourceI_CmsTemplateContextProvider.getEditorStyleSheet(org.opencms.file.CmsObject, java.lang.String)
public java.lang.String getOverrideCookieName()
I_CmsTemplateContextProvider
getOverrideCookieName
在接口中 I_CmsTemplateContextProvider
I_CmsTemplateContextProvider.getOverrideCookieName()
public CmsTemplateContext getTemplateContext(CmsObject cms, javax.servlet.http.HttpServletRequest request, CmsResource resource)
I_CmsTemplateContextProvider
getTemplateContext
在接口中 I_CmsTemplateContextProvider
cms
- the CMS contextrequest
- the current requestresource
- the resource being renderedI_CmsTemplateContextProvider.getTemplateContext(org.opencms.file.CmsObject, javax.servlet.http.HttpServletRequest, org.opencms.file.CmsResource)
public void initialize(CmsObject cms, java.lang.String config)
I_CmsTemplateContextProvider
initialize
在接口中 I_CmsTemplateContextProvider
cms
- the current CMS contextconfig
- the template context provider configurationI_CmsTemplateContextProvider.initialize(org.opencms.file.CmsObject, java.lang.String)
public java.lang.String readCommonProperty(CmsObject cms, java.lang.String propertyName, java.lang.String fallbackValue) throws CmsException
I_CmsTemplateContextProvider
This is needed because before template context providers, it was common to store template-specific configuration in a property on the template JSP. Since template context providers make the result ambiguous, this method is intended as a replacement.
readCommonProperty
在接口中 I_CmsTemplateContextProvider
cms
- the CMS context to usepropertyName
- the name of the propertyfallbackValue
- the value to return if no value is found or an error occursCmsException
- if something goes wrongI_CmsTemplateContextProvider.readCommonProperty(org.opencms.file.CmsObject, java.lang.String, java.lang.String)