Package org.opencms.jsp
Class CmsJspTagResourceLoad
- java.lang.Object
-
- javax.servlet.jsp.tagext.TagSupport
-
- javax.servlet.jsp.tagext.BodyTagSupport
-
- org.opencms.jsp.CmsJspScopedVarBodyTagSuport
-
- org.opencms.jsp.CmsJspTagResourceLoad
-
- All Implemented Interfaces:
java.io.Serializable
,javax.servlet.jsp.tagext.BodyTag
,javax.servlet.jsp.tagext.IterationTag
,javax.servlet.jsp.tagext.JspTag
,javax.servlet.jsp.tagext.Tag
,I_CmsResourceContainer
- Direct Known Subclasses:
CmsJspTagContentLoad
public class CmsJspTagResourceLoad extends CmsJspScopedVarBodyTagSuport implements I_CmsResourceContainer
Implementation of the<cms:resourceload/>
tag, used to access and display resource information from the VFS.- Since:
- 8.0
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected CmsObject
m_cms
The CmsObject for the current user.protected java.lang.String
m_collector
The name of the collector to use for list building.protected java.lang.String
m_collectorName
The name of the resource collector used.protected java.lang.String
m_collectorParam
The parameters of the resource collector uses.protected java.util.List<CmsResource>
m_collectorResult
The list of collected resource items.protected CmsContentInfoBean
m_contentInfoBean
The bean to store information required to make the result list browsable.protected CmsFlexController
m_controller
The FlexController for the current request.protected java.lang.String
m_pageIndex
The index of the current page that gets displayed.protected java.lang.String
m_pageNavLength
The number of page links in the Google-like page navigation.protected java.lang.String
m_pageSize
The size of a page to be displayed.protected java.lang.String
m_param
Parameter used for the collector.protected boolean
m_preload
Indicates if the collector results should be preloaded.protected java.lang.String
m_property
The (optional) property to extend the parameter with.protected CmsResource
m_resource
Reference to the last loaded resource element.protected java.lang.String
m_resourceName
The file name to load the current content value from.
-
Constructor Summary
Constructors Constructor Description CmsJspTagResourceLoad()
Empty constructor, required for JSP tags.CmsJspTagResourceLoad(I_CmsResourceContainer container, javax.servlet.jsp.PageContext context, java.lang.String collectorName, java.lang.String collectorParam)
Constructor used when usingresourceload
from scriptlet code.CmsJspTagResourceLoad(I_CmsResourceContainer container, javax.servlet.jsp.PageContext context, java.lang.String collectorName, java.lang.String collectorParam, java.lang.String pageIndex, java.lang.String pageSize)
Constructor used when usingresourceload
from scriptlet code.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
doAfterBody()
int
doEndTag()
protected void
doLoadNextResource()
Load the next resource from the initialized list of resources.int
doStartTag()
java.lang.String
getCollector()
Returns the collector.java.lang.String
getCollectorName()
Returns the name of the currently used resource collector.java.lang.String
getCollectorParam()
Returns the parameters of the currently used resource collector.java.util.List<CmsResource>
getCollectorResult()
Returns the list of all currently loaded resources (instances of
).CmsResource
protected CmsContentInfoBean
getContentInfoBean()
Returns the content info bean.protected CmsResource
getNextResource()
Returns the next resource from the collector.java.lang.String
getPageIndex()
Returns the index of the page to be displayed.java.lang.String
getPageNavLength()
Returns the number of page links in the Google-like page navigation.java.lang.String
getPageSize()
Returns the size of a single page to be displayed.java.lang.String
getParam()
Returns the collector parameter.java.lang.String
getPreload()
Returns"true"
if this content load tag should only preload the values from the collector.java.lang.String
getProperty()
Returns the property.CmsResource
getResource()
Returns the currently loaded resource.java.lang.String
getResourceName()
Returns the resource name in the VFS for the currently loaded resource.protected static java.lang.String
getResourceName(CmsObject cms, I_CmsResourceContainer contentContainer)
Returns the resource name currently processed.boolean
hasMoreContent()
Deprecated.boolean
hasMoreResources()
Resource iteration method to be used by JSP scriptlet code.protected void
init(I_CmsResourceContainer container)
Initializes this content load tag.boolean
isPreloader()
Returnstrue
if this container is used as a resource preloader.protected static java.util.List<CmsResource>
limitCollectorResult(CmsContentInfoBean contentInfoBean, java.util.List<CmsResource> collectorResult)
Limits the collector's result list to the size of a page to be displayed in a JSP.void
release()
void
setCollector(java.lang.String collector)
Sets the collector name.void
setPageIndex(java.lang.String pageIndex)
Sets the index of the page to be displayed.void
setPageNavLength(java.lang.String pageNavLength)
Sets the number of page links in the Google-like page navigation.void
setPageSize(java.lang.String pageSize)
Sets the size of a single page to be displayed.void
setParam(java.lang.String param)
Sets the collector parameter.void
setPreload(java.lang.String preload)
Sets the preload flag for this resource load tag.void
setProperty(java.lang.String property)
Sets the property.-
Methods inherited from class org.opencms.jsp.CmsJspScopedVarBodyTagSuport
getScope, getScopeAsInt, getScopeAsString, getScopeInt, getVar, isScopeVarSet, setScope, setVar, storeAttribute, storeAttribute
-
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, setBodyContent
-
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue
-
-
-
-
Field Detail
-
m_collector
protected java.lang.String m_collector
The name of the collector to use for list building.
-
m_collectorName
protected java.lang.String m_collectorName
The name of the resource collector used.
-
m_collectorParam
protected java.lang.String m_collectorParam
The parameters of the resource collector uses.
-
m_collectorResult
protected java.util.List<CmsResource> m_collectorResult
The list of collected resource items.
-
m_contentInfoBean
protected CmsContentInfoBean m_contentInfoBean
The bean to store information required to make the result list browsable.
-
m_controller
protected CmsFlexController m_controller
The FlexController for the current request.
-
m_pageIndex
protected java.lang.String m_pageIndex
The index of the current page that gets displayed.
-
m_pageNavLength
protected java.lang.String m_pageNavLength
The number of page links in the Google-like page navigation.
-
m_pageSize
protected java.lang.String m_pageSize
The size of a page to be displayed.
-
m_param
protected java.lang.String m_param
Parameter used for the collector.
-
m_preload
protected boolean m_preload
Indicates if the collector results should be preloaded.
-
m_property
protected java.lang.String m_property
The (optional) property to extend the parameter with.
-
m_resource
protected transient CmsResource m_resource
Reference to the last loaded resource element.
-
m_resourceName
protected java.lang.String m_resourceName
The file name to load the current content value from.
-
-
Constructor Detail
-
CmsJspTagResourceLoad
public CmsJspTagResourceLoad()
Empty constructor, required for JSP tags.
-
CmsJspTagResourceLoad
public CmsJspTagResourceLoad(I_CmsResourceContainer container, javax.servlet.jsp.PageContext context, java.lang.String collectorName, java.lang.String collectorParam) throws javax.servlet.jsp.JspException
Constructor used when usingresourceload
from scriptlet code.- Parameters:
container
- the parent resource container (could be a preloader)context
- the JSP page contextcollectorName
- the collector name to usecollectorParam
- the collector param to use- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong
-
CmsJspTagResourceLoad
public CmsJspTagResourceLoad(I_CmsResourceContainer container, javax.servlet.jsp.PageContext context, java.lang.String collectorName, java.lang.String collectorParam, java.lang.String pageIndex, java.lang.String pageSize) throws javax.servlet.jsp.JspException
Constructor used when usingresourceload
from scriptlet code.- Parameters:
container
- the parent resource container (could be a preloader)context
- the JSP page contextcollectorName
- the collector name to usecollectorParam
- the collector param to usepageIndex
- the display page index (may contain macros)pageSize
- the display page size (may contain macros)- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong
-
-
Method Detail
-
getResourceName
protected static java.lang.String getResourceName(CmsObject cms, I_CmsResourceContainer contentContainer)
Returns the resource name currently processed.- Parameters:
cms
- the current OpenCms user contextcontentContainer
- the current resource container- Returns:
- the resource name currently processed
-
limitCollectorResult
protected static java.util.List<CmsResource> limitCollectorResult(CmsContentInfoBean contentInfoBean, java.util.List<CmsResource> collectorResult)
Limits the collector's result list to the size of a page to be displayed in a JSP.- Parameters:
contentInfoBean
- the info bean of the collectorcollectorResult
- the result list of the collector- Returns:
- a limited collector's result list
-
doAfterBody
public int doAfterBody() throws javax.servlet.jsp.JspException
- Specified by:
doAfterBody
in interfacejavax.servlet.jsp.tagext.IterationTag
- Overrides:
doAfterBody
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
- See Also:
BodyTagSupport.doAfterBody()
-
doEndTag
public int doEndTag()
- Specified by:
doEndTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doEndTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- See Also:
Tag.doEndTag()
-
doStartTag
public int doStartTag() throws javax.servlet.jsp.JspException, CmsIllegalArgumentException
- Specified by:
doStartTag
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
doStartTag
in classjavax.servlet.jsp.tagext.BodyTagSupport
- Throws:
javax.servlet.jsp.JspException
CmsIllegalArgumentException
- See Also:
Tag.doStartTag()
-
getCollector
public java.lang.String getCollector()
Returns the collector.- Returns:
- the collector
-
getCollectorName
public java.lang.String getCollectorName()
Description copied from interface:I_CmsResourceContainer
Returns the name of the currently used resource collector.- Specified by:
getCollectorName
in interfaceI_CmsResourceContainer
- Returns:
- the name of the currently used resource collector
- See Also:
I_CmsResourceContainer.getCollectorName()
-
getCollectorParam
public java.lang.String getCollectorParam()
Description copied from interface:I_CmsResourceContainer
Returns the parameters of the currently used resource collector.- Specified by:
getCollectorParam
in interfaceI_CmsResourceContainer
- Returns:
- the parameters of the currently used resource collector
- See Also:
I_CmsResourceContainer.getCollectorParam()
-
getCollectorResult
public java.util.List<CmsResource> getCollectorResult()
Description copied from interface:I_CmsResourceContainer
Returns the list of all currently loaded resources (instances of
).CmsResource
- Specified by:
getCollectorResult
in interfaceI_CmsResourceContainer
- Returns:
- the list of all currently loaded resources
- See Also:
I_CmsResourceContainer.getCollectorResult()
-
getPageIndex
public java.lang.String getPageIndex()
Returns the index of the page to be displayed.- Returns:
- the index of the page to be displayed
-
getPageNavLength
public java.lang.String getPageNavLength()
Returns the number of page links in the Google-like page navigation.- Returns:
- the number of page links in the Google-like page navigation
-
getPageSize
public java.lang.String getPageSize()
Returns the size of a single page to be displayed.- Returns:
- the size of a single page to be displayed
-
getParam
public java.lang.String getParam()
Returns the collector parameter.- Returns:
- the collector parameter
-
getPreload
public java.lang.String getPreload()
Returns"true"
if this content load tag should only preload the values from the collector.- Returns:
"true"
if this content load tag should only preload the values from the collector
-
getProperty
public java.lang.String getProperty()
Returns the property.- Returns:
- the property
-
getResource
public CmsResource getResource()
Description copied from interface:I_CmsResourceContainer
Returns the currently loaded resource.- Specified by:
getResource
in interfaceI_CmsResourceContainer
- Returns:
- the currently loaded resource
- See Also:
I_CmsResourceContainer.getResource()
-
getResourceName
public java.lang.String getResourceName()
Description copied from interface:I_CmsResourceContainer
Returns the resource name in the VFS for the currently loaded resource.- Specified by:
getResourceName
in interfaceI_CmsResourceContainer
- Returns:
- the resource name in the VFS for the currently loaded resource
- See Also:
I_CmsResourceContainer.getResourceName()
-
hasMoreContent
@Deprecated public boolean hasMoreContent() throws javax.servlet.jsp.JspException
Deprecated.Description copied from interface:I_CmsResourceContainer
Resource iteration method to be used by JSP scriptlet code.Calling this method will insert "direct edit" HTML to the output page (if required).
- Specified by:
hasMoreContent
in interfaceI_CmsResourceContainer
- Returns:
true
if more resources are to be iterated- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong- See Also:
I_CmsResourceContainer.hasMoreContent()
-
hasMoreResources
public boolean hasMoreResources() throws javax.servlet.jsp.JspException
Description copied from interface:I_CmsResourceContainer
Resource iteration method to be used by JSP scriptlet code.Calling this method will insert "direct edit" HTML to the output page (if required).
- Specified by:
hasMoreResources
in interfaceI_CmsResourceContainer
- Returns:
true
if more resources are to be iterated- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong- See Also:
I_CmsResourceContainer.hasMoreResources()
-
isPreloader
public boolean isPreloader()
Description copied from interface:I_CmsResourceContainer
Returnstrue
if this container is used as a resource preloader.A resource preloader is used to load resources without looping through it.
- Specified by:
isPreloader
in interfaceI_CmsResourceContainer
- Returns:
true
if this container is used as a resource preloader- See Also:
I_CmsResourceContainer.isPreloader()
-
release
public void release()
- Specified by:
release
in interfacejavax.servlet.jsp.tagext.Tag
- Overrides:
release
in classCmsJspScopedVarBodyTagSuport
- See Also:
Tag.release()
-
setCollector
public void setCollector(java.lang.String collector)
Sets the collector name.- Parameters:
collector
- the collector name to set
-
setPageIndex
public void setPageIndex(java.lang.String pageIndex)
Sets the index of the page to be displayed.- Parameters:
pageIndex
- the index of the page to be displayed
-
setPageNavLength
public void setPageNavLength(java.lang.String pageNavLength)
Sets the number of page links in the Google-like page navigation.- Parameters:
pageNavLength
- the number of page links in the Google-like page navigation
-
setPageSize
public void setPageSize(java.lang.String pageSize)
Sets the size of a single page to be displayed.- Parameters:
pageSize
- the size of a single page to be displayed
-
setParam
public void setParam(java.lang.String param)
Sets the collector parameter.- Parameters:
param
- the collector parameter to set
-
setPreload
public void setPreload(java.lang.String preload)
Sets the preload flag for this resource load tag.If this is set to
true
, then the collector result will only be preloaded, but not iterated.- Parameters:
preload
- the preload flag to set
-
setProperty
public void setProperty(java.lang.String property)
Sets the property.- Parameters:
property
- the property to set
-
doLoadNextResource
protected void doLoadNextResource()
Load the next resource from the initialized list of resources.
-
getContentInfoBean
protected CmsContentInfoBean getContentInfoBean()
Returns the content info bean.- Returns:
- the content info bean
-
getNextResource
protected CmsResource getNextResource()
Returns the next resource from the collector.- Returns:
- the next resource from the collector
-
init
protected void init(I_CmsResourceContainer container) throws javax.servlet.jsp.JspException
Initializes this content load tag.- Parameters:
container
- the parent container (could be a preloader)- Throws:
javax.servlet.jsp.JspException
- in case something goes wrong
-
-