Class CmsRedirectLoader
- java.lang.Object
-
- org.opencms.loader.CmsRedirectLoader
-
- All Implemented Interfaces:
I_CmsConfigurationParameterHandler
,I_CmsFlexCacheEnabledLoader
,I_CmsResourceLoader
public class CmsRedirectLoader extends java.lang.Object implements I_CmsResourceLoader, I_CmsFlexCacheEnabledLoader
Loader for HTML redirects.
-
-
Field Summary
Fields Modifier and Type Field Description static int
LOADER_ID
The loader id.-
Fields inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD
-
Fields inherited from interface org.opencms.loader.I_CmsResourceLoader
PARAMETER_ELEMENT
-
-
Constructor Summary
Constructors Constructor Description CmsRedirectLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 locale, 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.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 the parameters of this configurable class instance, ornull
if the class does not need any parameters.protected CmsFlexController
getController(CmsObject cms, CmsResource resource, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, boolean streaming, boolean top)
Delivers a Flex controller, either by creating a new one, or by re-using an existing one.int
getLoaderId()
Returns the id of the ResourceLoader.java.lang.String
getResourceLoaderInfo()
Returns a String describing the ResourceLoader.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.void
setFlexCache(CmsFlexCache cache)
Will be called after the resource manager was initialized.
-
-
-
Field Detail
-
LOADER_ID
public static final int LOADER_ID
The loader id.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CmsRedirectLoader
public CmsRedirectLoader()
-
-
Method Detail
-
addConfigurationParameter
public void addConfigurationParameter(java.lang.String paramName, java.lang.String paramValue)
Description copied from interface:I_CmsConfigurationParameterHandler
Adds a configuration parameter to this parameter configurable class instance.- Specified by:
addConfigurationParameter
in interfaceI_CmsConfigurationParameterHandler
- Parameters:
paramName
- the name of the parameterparamValue
- the value for the parameter- See Also:
I_CmsConfigurationParameterHandler.addConfigurationParameter(java.lang.String, java.lang.String)
-
destroy
public void destroy()
Description copied from interface:I_CmsResourceLoader
Destroys this ResourceLoder.- Specified by:
destroy
in interfaceI_CmsResourceLoader
- See Also:
I_CmsResourceLoader.destroy()
-
dump
public byte[] dump(CmsObject cms, CmsResource resource, java.lang.String element, java.util.Locale locale, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws CmsException
Description copied from interface:I_CmsResourceLoader
Dumps the processed content of the the requested file (and it's sub-elements) to a byte array.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.
- Specified by:
dump
in interfaceI_CmsResourceLoader
- Parameters:
cms
- used to access the OpenCms VFSresource
- the requested resource in the VFSelement
- the element in the file to displaylocale
- the locale to displayreq
- the servlet requestres
- the servlet response- Returns:
- the content of the processed file
- Throws:
CmsException
- in case of errors accessing OpenCms functions- See Also:
I_CmsResourceLoader.dump(org.opencms.file.CmsObject, org.opencms.file.CmsResource, java.lang.String, java.util.Locale, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
-
export
public byte[] export(CmsObject cms, CmsResource resource, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
Description copied from interface:I_CmsResourceLoader
Static exports the contents of the requested file and it's sub-elements.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.
- Specified by:
export
in interfaceI_CmsResourceLoader
- Parameters:
cms
- the initialized CmsObject which provides user permissionsresource
- the requested OpenCms VFS resourcereq
- the servlet requestres
- the servlet response- Returns:
- the contents to export, or
null
if no export is required - See Also:
I_CmsResourceLoader.export(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
-
getConfiguration
public CmsParameterConfiguration getConfiguration()
Description copied from interface:I_CmsConfigurationParameterHandler
Returns the parameters of this configurable class instance, ornull
if the class does not need any parameters.- Specified by:
getConfiguration
in interfaceI_CmsConfigurationParameterHandler
- Returns:
- the parameters of this configurable class instance,
or
null
if the class does not need any parameters - See Also:
I_CmsConfigurationParameterHandler.getConfiguration()
-
getLoaderId
public int getLoaderId()
Description copied from interface:I_CmsResourceLoader
Returns the id of the ResourceLoader.- Specified by:
getLoaderId
in interfaceI_CmsResourceLoader
- Returns:
- the id of the ResourceLoader
- See Also:
I_CmsResourceLoader.getLoaderId()
-
getResourceLoaderInfo
public java.lang.String getResourceLoaderInfo()
Description copied from interface:I_CmsResourceLoader
Returns a String describing the ResourceLoader.- Specified by:
getResourceLoaderInfo
in interfaceI_CmsResourceLoader
- Returns:
- a String describing the ResourceLoader
- See Also:
I_CmsResourceLoader.getResourceLoaderInfo()
-
initConfiguration
public void initConfiguration()
Description copied from interface:I_CmsConfigurationParameterHandler
Initializes a configuration after all parameters have been added.- Specified by:
initConfiguration
in interfaceI_CmsConfigurationParameterHandler
- See Also:
I_CmsConfigurationParameterHandler.initConfiguration()
-
isStaticExportEnabled
public boolean isStaticExportEnabled()
Description copied from interface:I_CmsResourceLoader
Signals if the loader implementation supports static export of resources.- Specified by:
isStaticExportEnabled
in interfaceI_CmsResourceLoader
- Returns:
- true if static export is supported, false otherwise
- See Also:
I_CmsResourceLoader.isStaticExportEnabled()
-
isStaticExportProcessable
public boolean isStaticExportProcessable()
Description copied from interface:I_CmsResourceLoader
Signals if the loader implementation requires processing during static export of resources.- Specified by:
isStaticExportProcessable
in interfaceI_CmsResourceLoader
- Returns:
- true if static export processing is required, false otherwise
- See Also:
I_CmsResourceLoader.isStaticExportProcessable()
-
isUsableForTemplates
public boolean isUsableForTemplates()
Description copied from interface:I_CmsResourceLoader
Signals if the loader implementation is usable for creating templates.- Specified by:
isUsableForTemplates
in interfaceI_CmsResourceLoader
- Returns:
- true if the loader implementation is usable for creating templates, false otherwise
- See Also:
I_CmsResourceLoader.isUsableForTemplates()
-
isUsingUriWhenLoadingTemplate
public boolean isUsingUriWhenLoadingTemplate()
Description copied from interface:I_CmsResourceLoader
Signals if a loader that supports templates must be invoked on the template URI or the resource URI.- Specified by:
isUsingUriWhenLoadingTemplate
in interfaceI_CmsResourceLoader
- Returns:
- true if the resource URI is to be used, false if the template URI is to be used
- See Also:
I_CmsResourceLoader.isUsingUriWhenLoadingTemplate()
-
load
public void load(CmsObject cms, CmsResource resource, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws CmsException
Description copied from interface:I_CmsResourceLoader
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.- Specified by:
load
in interfaceI_CmsResourceLoader
- Parameters:
cms
- the initialized CmsObject which provides user permissionsresource
- the requested OpenCms VFS resourcereq
- the servlet requestres
- the servlet response- Throws:
CmsException
- in case of errors accessing OpenCms functions- See Also:
I_CmsResourceLoader.load(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
-
service
public void service(CmsObject cms, CmsResource resource, javax.servlet.ServletRequest req, javax.servlet.ServletResponse res)
Description copied from interface:I_CmsResourceLoader
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.- Specified by:
service
in interfaceI_CmsResourceLoader
- Parameters:
cms
- used to access the OpenCms VFSresource
- the requested resource in the VFSreq
- the servlet requestres
- the servlet response- See Also:
I_CmsResourceLoader.service(org.opencms.file.CmsObject, org.opencms.file.CmsResource, javax.servlet.ServletRequest, javax.servlet.ServletResponse)
-
setFlexCache
public void setFlexCache(CmsFlexCache cache)
Description copied from interface:I_CmsFlexCacheEnabledLoader
Will be called after the resource manager was initialized.- Specified by:
setFlexCache
in interfaceI_CmsFlexCacheEnabledLoader
- Parameters:
cache
- the (optional) flex cache instance to use- See Also:
I_CmsFlexCacheEnabledLoader.setFlexCache(org.opencms.flex.CmsFlexCache)
-
getController
protected CmsFlexController getController(CmsObject cms, CmsResource resource, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, boolean streaming, boolean top)
Delivers a Flex controller, either by creating a new one, or by re-using an existing one.- Parameters:
cms
- the initial CmsObject to wrap in the controllerresource
- the resource requestedreq
- the current requestres
- the current responsestreaming
- indicates if the response is streamingtop
- indicates if the response is the top response- Returns:
- a Flex controller
-
-