|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.jsp.util.CmsJspResourceAccessBean
public class CmsJspResourceAccessBean
Allows access to the attributes and properties of a resource, usually used inside a loop of a
<cms:resourceload>
tag.
The implementation is optimized for performance and uses lazy initializing of the requested values as much as possible.
CmsJspTagResourceAccess
Constructor Summary | |
---|---|
CmsJspResourceAccessBean()
No argument constructor, required for a JavaBean. |
|
CmsJspResourceAccessBean(CmsObject cms,
CmsResource resource)
Creates a content access bean based on a Resource. |
Method Summary | |
---|---|
CmsObject |
getCmsObject()
Returns the OpenCms user context this bean was initialized with. |
CmsFile |
getFile()
Returns the raw VFS file object of the current resource. |
String |
getFileContentAsString()
Returns the file contents of the raw VFS file object as String. |
String |
getFilename()
Returns the site path of the current resource, that is the result of CmsObject.getSitePath(CmsResource) with the resource
obtained by getFile() . |
Map<String,String> |
getHistoryProperty()
Short form for getReadHistoryProperties() . |
Map<String,String> |
getProperty()
Short form for getReadProperties() . |
Map<String,String> |
getReadHistoryProperties()
Returns a map that lazily reads history properties of the resource. |
Map<String,String> |
getReadProperties()
Returns a map that lazily reads properties of the resource. |
CmsResource |
getResource()
Returns the current resource. |
CmsJspVfsAccessBean |
getVfs()
Returns an instance of a VFS access bean, initialized with the OpenCms user context this bean was created with. |
void |
init(CmsObject cms,
CmsResource resource)
Initialize this instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CmsJspResourceAccessBean()
You must call init(CmsObject, CmsResource)
and provide the
required values when you use this constructor.
init(CmsObject, CmsResource)
public CmsJspResourceAccessBean(CmsObject cms, CmsResource resource)
cms
- the OpenCms context of the current userresource
- the resource to create the content fromMethod Detail |
---|
public CmsObject getCmsObject()
public CmsFile getFile()
This can be used to access information from the raw file on a JSP.
Usage example on a JSP with the JSTL:
<cms:resourceload ... > <cms:resourceaccess var="res" /> Root path of the resource: ${res.file.rootPath} </cms:resourceload>
public String getFileContentAsString()
Usage example on a JSP with the JSTL:
<cms:resourceload ... > <cms:resourceaccess var="res" /> String content of the resource: ${res.fileContentAsString} </cms:resourceload>
public String getFilename()
CmsObject.getSitePath(CmsResource)
with the resource
obtained by getFile()
.Usage example on a JSP with the JSTL:
&<cms:resourceload ... > <cms:resourceaccess var="res" /> Site path of the resource: "${res.filename}"; </cms:resourceload>
CmsObject.getSitePath(CmsResource)
public Map<String,String> getHistoryProperty()
getReadHistoryProperties()
.
This works only if the current resource is implementing I_CmsHistoryResource
.
Usage example on a JSP with the <cms:resourceaccess>
tag:
<cms:resourceload ... > <cms:resourceaccess var="res" /> History "Title" property value of the resource: ${res.historyProperty['Title']} </cms:resourceload>
getReadHistoryProperties()
public Map<String,String> getProperty()
getReadProperties()
.
Usage example on a JSP with the <cms:resourceaccess>
tag:
<cms:resourceload ... > <cms:resourceaccess var="res" /> "Title" property value of the resource: ${res.property['Title']} </cms:resourceload>
getReadProperties()
public Map<String,String> getReadHistoryProperties()
This works only if the current resource is implementing I_CmsHistoryResource
.
Usage example on a JSP with the <cms:resourceaccess>
tag:
<cms:resourceload ... > <cms:resourceaccess var="res" /> History "Title" property value of the resource: ${res.readHistoryProperties['Title']} </cms:resourceload>
for a short form of this method
public Map<String,String> getReadProperties()
Usage example on a JSP with the <cms:resourceaccess>
tag:
<cms:resourceload ... > <cms:resourceaccess var="res" /> "Title" property value of the resource: ${res.readProperties['Title']} </cms:resourceload>
for a short form of this method
public CmsResource getResource()
Usage example on a JSP with the JSTL:
&<cms:resourceload ... > <cms:resourceaccess var="res" /> Root path of the resource: "${res.resource.rootPath}"; </cms:resourceload>
public CmsJspVfsAccessBean getVfs()
public void init(CmsObject cms, CmsResource resource)
cms
- the OpenCms context of the current userresource
- the resource to create the content from
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |