public final class CmsJspStandardContextBean extends java.lang.Object
This bean is available by default in the context of an OpenCms managed JSP.
Modifier and Type | Class and Description |
---|---|
class |
CmsJspStandardContextBean.CmsContainerElementWrapper
Container element wrapper to add some API methods.
|
class |
CmsJspStandardContextBean.CmsDetailLookupTransformer
Provides a lazy initialized Map that provides the detail page link as a value when given the name of a
(named) dynamic function or resource type as a key.
|
class |
CmsJspStandardContextBean.SettingsTransformer
The element setting transformer.
|
static class |
CmsJspStandardContextBean.TemplateBean
Bean containing a template name and URI.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTRIBUTE_CMS_OBJECT
The attribute name of the cms object.
|
static java.lang.String |
ATTRIBUTE_NAME
The attribute name of the standard JSP context bean.
|
protected static org.apache.commons.logging.Log |
LOG
The logger instance for this class.
|
protected CmsObject |
m_cms
OpenCms user context.
|
Modifier and Type | Method and Description |
---|---|
CmsJspStandardContextBean |
createCopy()
Returns a copy of this JSP context bean.
|
java.lang.String |
elementCachingHash()
Returns a caching hash specific to the element, it's properties and the current container width.
|
java.util.List<java.util.Locale> |
getAvailableLocales()
Returns the locales available for the currently requested URI.
|
java.lang.Object |
getBean(java.lang.String className)
Helper for easy instantiation and initialization of custom context beans that returns
an instance of the class specified via
className , with the current context already set. |
CmsContainerBean |
getContainer()
Returns the container the currently rendered element is part of.
|
CmsJspResourceWrapper |
getDetailContent()
Returns the current detail content, or
null if no detail content is requested. |
CmsUUID |
getDetailContentId()
Returns the structure id of the current detail content, or
null if no detail content is requested. |
java.lang.String |
getDetailContentSitePath()
Returns the detail content site path, or
null if not available. |
CmsJspResourceWrapper |
getDetailFunctionPage()
Returns the detail function page.
|
CmsContainerPageBean |
getDetailOnlyPage()
Returns the detail only page.
|
CmsJspStandardContextBean.CmsContainerElementWrapper |
getElement()
Returns the currently rendered element.
|
java.util.Map<java.lang.String,java.util.List<CmsJspStandardContextBean.CmsContainerElementWrapper>> |
getElementBeansInContainers()
Returns a lazy initialized map of wrapped container elements beans by container name suffix.
|
protected I_CmsFormatterBean |
getElementFormatter(CmsContainerElementBean element)
Returns the formatter configuration to the given element.
|
java.util.Map<java.lang.String,java.util.List<CmsJspResourceWrapper>> |
getElementsInContainer()
Returns a lazy initialized map of wrapped element resources by container name.
|
java.util.Map<java.lang.String,java.util.List<CmsJspResourceWrapper>> |
getElementsInContainers()
Returns a lazy initialized map of wrapped element resources by container name suffix.
|
java.lang.String |
getEnableReload()
Alternative method name for getReloadMarker().
|
java.util.Map<java.lang.String,CmsDynamicFunctionBeanWrapper> |
getFunction()
Returns a lazy initialized Map which allows access to the dynamic function beans using the JSP EL.
|
java.util.Map<java.lang.String,java.lang.String> |
getFunctionDetail()
Deprecated.
use
getFunctionDetailPage() instead |
java.util.Map<java.lang.String,java.lang.String> |
getFunctionDetailPage()
Returns a lazy initialized Map that provides the detail page link as a value when given the name of a
(named) dynamic function as a key.
|
java.util.Map<CmsJspContentAccessBean,CmsDynamicFunctionFormatWrapper> |
getFunctionFormatFromContent()
Returns a lazy map which creates a wrapper object for a dynamic function format when given an XML content
as a key.
|
static CmsJspStandardContextBean |
getInstance(javax.servlet.ServletRequest req)
Creates a new instance of the standard JSP context bean.
|
boolean |
getIsEditMode()
Checks if the current request should be direct edit enabled.
|
boolean |
getIsJSONRequest()
Returns true if the current request is a JSON request.
|
boolean |
getIsOnlineProject()
Returns if the current project is the online project.
|
java.util.Locale |
getLocale()
Returns the current locale.
|
java.util.Map<java.lang.String,CmsJspResourceWrapper> |
getLocaleResource()
Gets a map providing access to the locale variants of the current page.
|
protected java.lang.String |
getLocaleSpecificTitle(java.util.Locale locale)
Returns the title according to the given locale.
|
java.util.Locale |
getMainLocale()
Gets the main locale for the current page's locale group.
|
java.util.Map<java.lang.String,java.lang.String> |
getMeta()
Returns the meta mappings map.
|
CmsContainerPageBean |
getPage()
Returns the currently displayed container page.
|
CmsContainerPageBean |
getPage(java.lang.Object page,
java.lang.Object locale)
Returns the container page bean for the give page and locale.
|
CmsJspResourceWrapper |
getPageResource()
Returns the current container page resource.
|
CmsContainerBean |
getParentContainer()
Returns the parent container to the current container if available.
|
java.util.Map<java.lang.String,CmsContainerBean> |
getParentContainers()
Returns the instance id parent container mapping.
|
CmsContainerElementBean |
getParentElement()
Returns the parent element to the current element if available.
|
protected CmsContainerElementBean |
getParentElement(CmsContainerElementBean element)
Returns the parent element if available.
|
java.util.Map<java.lang.String,java.lang.String> |
getPreviewFormatter()
JSP EL accessor method for retrieving the preview formatters.
|
java.util.Map<java.lang.String,CmsJspCategoryAccessBean> |
getReadAllSubCategories()
Reads all sub-categories below the provided category.
|
CmsJspCategoryAccessBean |
getReadCategories()
Reads the categories assigned to the currently requested URI.
|
java.util.Map<java.lang.String,CmsCategory> |
getReadCategory()
Transforms the category path of a category to the category.
|
java.util.Map<java.lang.String,java.util.List<CmsCategory>> |
getReadPathCategories()
Transforms the category path to the list of all categories on that path.
|
java.util.Map<java.lang.String,CmsJspCategoryAccessBean> |
getReadResourceCategories()
Reads the categories assigned to a resource.
|
java.lang.String |
getReloadMarker()
Returns a HTML comment string that will cause the container page editor to reload the page if the element or its settings
were edited.
|
CmsRequestContext |
getRequestContext()
Returns the request context.
|
CmsSite |
getSite()
Returns the current site.
|
java.util.Map<java.lang.String,java.lang.String> |
getSitePath()
Transforms root paths to site paths.
|
java.lang.String |
getSubSitePath()
Returns the subsite path for the currently requested URI.
|
CmsSystemInfo |
getSystemInfo()
Returns the system information.
|
CmsJspStandardContextBean.TemplateBean |
getTemplate()
Gets a bean containing information about the current template.
|
java.lang.String |
getTitle()
Returns the title of a page delivered from OpenCms, usually used for the
<title> tag of
a HTML page. |
java.util.Map<java.lang.String,java.lang.String> |
getTitleLocale()
Get the title and read the Title property according the provided locale.
|
java.util.Map<java.lang.String,java.lang.String> |
getTypeDetailPage()
Returns a lazy initialized Map that provides the detail page link as a value when given the name of a
resource type as a key.
|
CmsJspVfsAccessBean |
getVfs()
Returns an initialized VFS access bean.
|
java.util.Locale |
getWorkplaceLocale()
Returns the workplace locale from the current user's settings.
|
java.util.Map<java.lang.Object,java.lang.Object> |
getWrap()
Returns an EL access wrapper map for the given object.
|
void |
initPage()
Initializes the requested container page.
|
boolean |
isDetailPageAvailable()
Returns true
|
boolean |
isDetailRequest()
Returns
true if this is a request to a detail resource, false otherwise. |
boolean |
isDragMode()
Returns if the page is in drag mode.
|
boolean |
isEdited()
Returns the flag to indicate if in drag and drop mode.
|
boolean |
isModelGroupElement()
Returns if the current element is a model group.
|
boolean |
isModelGroupPage()
Returns if the current page is used to manage model groups.
|
protected CmsDynamicFunctionBean |
readDynamicFunctionBean(java.lang.String configuredName)
Reads a dynamic function bean, given its name in the module configuration.
|
void |
setContainer(CmsContainerBean container)
Sets the container the currently rendered element is part of.
|
void |
setDetailOnlyPage(CmsContainerPageBean detailOnlyPage)
Sets the detail only page.
|
void |
setDragMode(boolean isDragMode)
Sets if the page is in drag mode.
|
void |
setEdited(boolean edited)
Sets the flag to indicate if in drag and drop mode.
|
void |
setElement(CmsContainerElementBean element)
Sets the currently rendered element.
|
void |
setPage(CmsContainerPageBean page)
Sets the currently displayed container page.
|
void |
updateCmsObject(CmsObject cms)
Updates the internally stored OpenCms user context.
|
void |
updateRequestData(CmsFlexRequest cmsFlexRequest)
Updates the standard context bean from the request.
|
public static final java.lang.String ATTRIBUTE_CMS_OBJECT
public static final java.lang.String ATTRIBUTE_NAME
protected static final org.apache.commons.logging.Log LOG
public static CmsJspStandardContextBean getInstance(javax.servlet.ServletRequest req)
To prevent multiple creations of the bean during a request, the OpenCms request context attributes are used to cache the created VFS access utility bean.
req
- the current servlet requestpublic CmsJspStandardContextBean createCopy()
public java.lang.String elementCachingHash()
public java.util.List<java.util.Locale> getAvailableLocales()
public java.lang.Object getBean(java.lang.String className)
className
, with the current context already set.className
- name of the class to instantiate. Must be a subclass of A_CmsJspCustomContextBean
.public CmsContainerBean getContainer()
public CmsJspResourceWrapper getDetailContent()
null
if no detail content is requested.null
if no detail content is requested.public CmsUUID getDetailContentId()
null
if no detail content is requested.null
if no detail content is requested.public java.lang.String getDetailContentSitePath()
null
if not available.public CmsJspResourceWrapper getDetailFunctionPage()
public CmsContainerPageBean getDetailOnlyPage()
public CmsJspStandardContextBean.CmsContainerElementWrapper getElement()
public java.util.Map<java.lang.String,java.util.List<CmsJspStandardContextBean.CmsContainerElementWrapper>> getElementBeansInContainers()
So in case there is more than one container where the name end with the given suffix, a joined list of container elements beans is returned.
getElementsInContainer()
public java.util.Map<java.lang.String,java.util.List<CmsJspResourceWrapper>> getElementsInContainer()
public java.util.Map<java.lang.String,java.util.List<CmsJspResourceWrapper>> getElementsInContainers()
So in case there is more than one container where the name end with the given suffix, a joined list of elements is returned.
getElementBeansInContainers()
public java.lang.String getEnableReload()
getReloadMarker()
public java.util.Map<java.lang.String,CmsDynamicFunctionBeanWrapper> getFunction()
When given a key, the returned map will look up the corresponding dynamic function bean in the module configuration.
@Deprecated public java.util.Map<java.lang.String,java.lang.String> getFunctionDetail()
getFunctionDetailPage()
insteadpublic java.util.Map<java.lang.String,java.lang.String> getFunctionDetailPage()
The provided Map key is assumed to be a String that represents a named dynamic function.
Usage example on a JSP with the JSTL:
<a href=${cms.functionDetailPage['search']} />
getTypeDetailPage()
public java.util.Map<CmsJspContentAccessBean,CmsDynamicFunctionFormatWrapper> getFunctionFormatFromContent()
public boolean getIsEditMode()
true
if the current request should be direct edit enabledpublic boolean getIsJSONRequest()
public boolean getIsOnlineProject()
true
if the current project is the online projectpublic java.util.Locale getLocale()
public java.util.Map<java.lang.String,CmsJspResourceWrapper> getLocaleResource()
Note that all available locales for the site / subsite are used as keys, not just the ones for which a locale variant actually exists. Usage in JSPs: ${cms.localeResource['de']]
public java.util.Locale getMainLocale()
public java.util.Map<java.lang.String,java.lang.String> getMeta()
public CmsContainerPageBean getPage()
public CmsContainerPageBean getPage(java.lang.Object page, java.lang.Object locale)
page
- the container page resource as id, path or already as resourcelocale
- the content locale as locale or stringpublic CmsJspResourceWrapper getPageResource()
public CmsContainerBean getParentContainer()
public java.util.Map<java.lang.String,CmsContainerBean> getParentContainers()
public CmsContainerElementBean getParentElement()
public java.util.Map<java.lang.String,java.lang.String> getPreviewFormatter()
public java.util.Map<java.lang.String,CmsJspCategoryAccessBean> getReadAllSubCategories()
CmsJspCategoryAccessBean
.public CmsJspCategoryAccessBean getReadCategories()
public java.util.Map<java.lang.String,CmsCategory> getReadCategory()
public java.util.Map<java.lang.String,java.util.List<CmsCategory>> getReadPathCategories()
Example: For path "location/europe/"
the list [getReadCategory.get("location/"),getReadCategory.get("location/europe/")]
is returned.
public java.util.Map<java.lang.String,CmsJspCategoryAccessBean> getReadResourceCategories()
public java.lang.String getReloadMarker()
public CmsRequestContext getRequestContext()
public java.util.Map<java.lang.String,java.lang.String> getSitePath()
CmsRequestContext.removeSiteRoot(String)
public java.lang.String getSubSitePath()
public CmsSystemInfo getSystemInfo()
public CmsJspStandardContextBean.TemplateBean getTemplate()
public java.lang.String getTitle()
<title>
tag of
a HTML page.If no title information has been found, the empty String "" is returned.
public java.util.Map<java.lang.String,java.lang.String> getTitleLocale()
public java.util.Map<java.lang.String,java.lang.String> getTypeDetailPage()
The provided Map key is assumed to be the name of a resource type that has a detail page configured.
Usage example on a JSP with the JSTL:
<a href=${cms.typeDetailPage['bs-blog']} />
getFunctionDetailPage()
public CmsJspVfsAccessBean getVfs()
public java.util.Locale getWorkplaceLocale()
public java.util.Map<java.lang.Object,java.lang.Object> getWrap()
If the object is a CmsResource
, then a CmsJspResourceWrapper
is returned.
Otherwise the object is wrapped in a CmsJspObjectValueWrapper
.
If the object is already is a wrapper, it is returned unchanged.
public void initPage() throws CmsException
CmsException
- in case reading the requested resource failspublic boolean isDetailPageAvailable()
true
true
public boolean isDetailRequest()
true
if this is a request to a detail resource, false
otherwise.
Same as to check if getDetailContent()
is null
.
true
if this is a request to a detail resource, false
otherwisepublic boolean isDragMode()
public boolean isEdited()
true
if in drag and drop modepublic boolean isModelGroupElement()
true
if the current element is a model grouppublic boolean isModelGroupPage()
true
if the current page is used to manage model groupspublic void setContainer(CmsContainerBean container)
container
- the container the currently rendered element is part ofpublic void setDetailOnlyPage(CmsContainerPageBean detailOnlyPage)
detailOnlyPage
- the detail only page to setpublic void setDragMode(boolean isDragMode)
isDragMode
- if the page is in drag modepublic void setEdited(boolean edited)
edited
- true
if in drag and drop modepublic void setElement(CmsContainerElementBean element)
element
- the currently rendered element to setpublic void setPage(CmsContainerPageBean page)
page
- the currently displayed container page to setpublic void updateCmsObject(CmsObject cms)
cms
- the new OpenCms user contextpublic void updateRequestData(CmsFlexRequest cmsFlexRequest)
cmsFlexRequest
- the request from which to update the dataprotected I_CmsFormatterBean getElementFormatter(CmsContainerElementBean element)
element
- the elementprotected java.lang.String getLocaleSpecificTitle(java.util.Locale locale)
locale
- the locale for which the title should be read.protected CmsContainerElementBean getParentElement(CmsContainerElementBean element)
element
- the elementprotected CmsDynamicFunctionBean readDynamicFunctionBean(java.lang.String configuredName) throws CmsException
configuredName
- the name of the dynamic function in the module configurationCmsException
- if something goes wrong