public class CmsXmlContainerPageLoader extends CmsXmlContentLoader
CmsResourceTypeXmlContainerPage
.It is just a xml-content loader with template capabilities.
Modifier and Type | Field and Description |
---|---|
static int |
CONTAINER_PAGE_RESOURCE_LOADER_ID
The id of this loader.
|
RESOURCE_LOADER_ID
PARAMETER_ELEMENT
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD
Constructor and Description |
---|
CmsXmlContainerPageLoader()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addConfigurationParameter(java.lang.String paramName,
java.lang.String paramValue)
Adds a configuration parameter to this parameter configurable class instance.
|
void |
destroy()
Destroys this ResourceLoder.
|
byte[] |
dump(CmsObject cms,
CmsResource resource,
java.lang.String element,
java.util.Locale selectedLocale,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Dumps the processed content of the the requested file (and it's sub-elements) to a byte array.
|
java.lang.String |
dumpAsString(CmsObject cms,
CmsResource resource,
java.lang.String element,
java.util.Locale selectedLocale,
javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res)
Dumps the processed content of the the requested file (and it's sub-elements) to a String.
|
byte[] |
export(CmsObject cms,
CmsResource resource,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Static exports the contents of the requested file and it's sub-elements.
|
CmsParameterConfiguration |
getConfiguration()
Returns
null since XML document loaders does usually not need to be configured. |
int |
getLoaderId()
Returns the id of the ResourceLoader.
|
java.lang.String |
getResourceLoaderInfo()
Returns a String describing this resource loader, which is (localized to the system default locale)
"The OpenCms default resource loader for container page" . |
protected CmsTemplateLoaderFacade |
getTemplateLoaderFacade(CmsObject cms,
CmsResource resource,
javax.servlet.http.HttpServletRequest req)
Returns the template loader facade for the given resource.
|
protected java.lang.String |
getTemplatePropertyDefinition()
Returns the property definition name used to selecte the template for this XML document resource loader.
|
void |
initConfiguration()
Initializes a configuration after all parameters have been added.
|
boolean |
isStaticExportEnabled()
Signals if the loader implementation supports static export of resources.
|
boolean |
isStaticExportProcessable()
Signals if the loader implementation requires processing during static export of resources.
|
boolean |
isUsableForTemplates()
Signals if the loader implementation is usable for creating templates.
|
boolean |
isUsingUriWhenLoadingTemplate()
Signals if a loader that supports templates must be invoked on the
template URI or the resource URI.
|
void |
load(CmsObject cms,
CmsResource resource,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Basic top-page processing method for a I_CmsResourceLoader,
this method is called if the page is called as a sub-element
on a page not already loaded with a I_CmsResourceLoader.
|
void |
service(CmsObject cms,
CmsResource resource,
javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res)
Does the job of including the requested resource,
this method is called directly if the element is
called as a sub-element from another I_CmsResourceLoader.
|
protected CmsXmlContainerPage |
unmarshalXmlDocument(CmsObject cms,
CmsResource resource,
javax.servlet.ServletRequest req)
Returns the unmarshalled XML document.
|
public static final int CONTAINER_PAGE_RESOURCE_LOADER_ID
public CmsXmlContainerPageLoader()
public int getLoaderId()
I_CmsResourceLoader
getLoaderId
in interface I_CmsResourceLoader
getLoaderId
in class CmsXmlContentLoader
I_CmsResourceLoader.getLoaderId()
public java.lang.String getResourceLoaderInfo()
"The OpenCms default resource loader for container page"
.getResourceLoaderInfo
in interface I_CmsResourceLoader
getResourceLoaderInfo
in class CmsXmlContentLoader
public boolean isUsableForTemplates()
I_CmsResourceLoader
isUsableForTemplates
in interface I_CmsResourceLoader
A_CmsXmlDocumentLoader.isUsableForTemplates()
public void load(CmsObject cms, CmsResource resource, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException, CmsException
I_CmsResourceLoader
load
in interface I_CmsResourceLoader
cms
- the initialized CmsObject which provides user permissionsresource
- the requested OpenCms VFS resourcereq
- the servlet requestres
- the servlet responsejavax.servlet.ServletException
- might be thrown by the servlet environmentjava.io.IOException
- might be thrown by the servlet environmentCmsException
- in case of errors accessing OpenCms functionsA_CmsXmlDocumentLoader.load(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
protected java.lang.String getTemplatePropertyDefinition()
getTemplatePropertyDefinition
in class CmsXmlContentLoader
A_CmsXmlDocumentLoader.getTemplatePropertyDefinition()
protected CmsXmlContainerPage unmarshalXmlDocument(CmsObject cms, CmsResource resource, javax.servlet.ServletRequest req) throws CmsException
unmarshalXmlDocument
in class CmsXmlContentLoader
cms
- the current users OpenCms contextresource
- the requested resourcereq
- the current Servlet requestCmsException
- in case the unmarshalling failsA_CmsXmlDocumentLoader.unmarshalXmlDocument(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest)
public void addConfigurationParameter(java.lang.String paramName, java.lang.String paramValue)
I_CmsConfigurationParameterHandler
addConfigurationParameter
in interface I_CmsConfigurationParameterHandler
paramName
- the name of the parameterparamValue
- the value for the parameterI_CmsConfigurationParameterHandler.addConfigurationParameter(java.lang.String, java.lang.String)
public void destroy()
I_CmsResourceLoader
destroy
in interface I_CmsResourceLoader
I_CmsResourceLoader.destroy()
public byte[] dump(CmsObject cms, CmsResource resource, java.lang.String element, java.util.Locale selectedLocale, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws CmsException, java.io.IOException
I_CmsResourceLoader
Dumping the content is like calling "load" where the result is not written to the response stream, but to the returned byte array. Dumping is different from an export because the export might actually require that the content is handled or modified in a special way, or set special http headers.
Moreover, if the page type is template based, calling "dump" will not trigger the template but directly deliver the contents from the selected element.
dump
in interface I_CmsResourceLoader
cms
- used to access the OpenCms VFSresource
- the requested resource in the VFSelement
- the element in the file to displayselectedLocale
- the locale to displayreq
- the servlet requestres
- the servlet responseCmsException
- in case of errors accessing OpenCms functionsjava.io.IOException
- might be thrown by the servlet environmentI_CmsResourceLoader.dump(org.opencms.file.CmsObject, org.opencms.file.CmsResource, java.lang.String, java.util.Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
public java.lang.String dumpAsString(CmsObject cms, CmsResource resource, java.lang.String element, java.util.Locale selectedLocale, javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws CmsException
I_CmsResourceStringDumpLoader
This is a special form of
where the result is required in a String, for example for printing it to a writer.I_CmsResourceLoader.dump(CmsObject, CmsResource, String, Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
dumpAsString
in interface I_CmsResourceStringDumpLoader
cms
- used to access the OpenCms VFSresource
- the requested resource in the VFSelement
- the element in the file to displayselectedLocale
- the locale to displayreq
- the servlet requestres
- the servlet responseCmsException
- in case of errors acessing OpenCms functionsI_CmsResourceStringDumpLoader.dumpAsString(org.opencms.file.CmsObject, org.opencms.file.CmsResource, java.lang.String, java.util.Locale, javax.servlet.ServletRequest, javax.servlet.ServletResponse)
public byte[] export(CmsObject cms, CmsResource resource, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException, CmsException
I_CmsResourceLoader
During static export, the resource content may be written to 2 streams: The export stream, and the http response output stream. Which stream is actually used depends whether the export is in "on demand" or "after publish" mode. In "on demand" mode, the resource needs to be written both to the response stream and to the file stream. In "after publish" mode, it's usually only written to the file stream, but sometimes it's required to write to the response stream as well.
export
in interface I_CmsResourceLoader
cms
- the initialized CmsObject which provides user permissionsresource
- the requested OpenCms VFS resourcereq
- the servlet requestres
- the servlet responsenull
if no export is requiredjavax.servlet.ServletException
- might be thrown in the process of including the sub elementjava.io.IOException
- might be thrown in the process of including the sub elementCmsException
- in case something goes wrongI_CmsResourceLoader.export(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
public CmsParameterConfiguration getConfiguration()
null
since XML document loaders does usually not need to be configured.getConfiguration
in interface I_CmsConfigurationParameterHandler
null
if the class does not need any parametersI_CmsConfigurationParameterHandler.getConfiguration()
public void initConfiguration()
I_CmsConfigurationParameterHandler
initConfiguration
in interface I_CmsConfigurationParameterHandler
I_CmsConfigurationParameterHandler.initConfiguration()
public boolean isStaticExportEnabled()
I_CmsResourceLoader
isStaticExportEnabled
in interface I_CmsResourceLoader
I_CmsResourceLoader.isStaticExportEnabled()
public boolean isStaticExportProcessable()
I_CmsResourceLoader
isStaticExportProcessable
in interface I_CmsResourceLoader
I_CmsResourceLoader.isStaticExportProcessable()
public boolean isUsingUriWhenLoadingTemplate()
I_CmsResourceLoader
isUsingUriWhenLoadingTemplate
in interface I_CmsResourceLoader
I_CmsResourceLoader.isUsingUriWhenLoadingTemplate()
public void service(CmsObject cms, CmsResource resource, javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws java.io.IOException, CmsException
I_CmsResourceLoader
service
in interface I_CmsResourceLoader
cms
- used to access the OpenCms VFSresource
- the requested resource in the VFSreq
- the servlet requestres
- the servlet responsejava.io.IOException
- might be thrown by the servlet environmentCmsException
- in case of errors accessing OpenCms functionsI_CmsResourceLoader.service(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest, javax.servlet.ServletResponse)
protected CmsTemplateLoaderFacade getTemplateLoaderFacade(CmsObject cms, CmsResource resource, javax.servlet.http.HttpServletRequest req) throws CmsException
cms
- the cms contextresource
- the resourcereq
- the current requestCmsException
- in case reading the template property fails