Class CmsStaticExportManager

    • Constructor Detail

    • Method Detail

      • getRfsPath

        public static java.lang.String getRfsPath​(java.lang.String filename,
                                                  java.lang.String extension,
                                                  java.lang.String parameters)
        Creates unique, valid RFS name for the given filename that contains a coded version of the given parameters, with the given file extension appended.

        Adapted from CmsFileUtil.getRfsPath().

        Parameters:
        filename - the base file name
        extension - the extension to use
        parameters - the parameters to code in the result file name
        Returns:
        a unique, valid RFS name for the given parameters
        See Also:
        CmsStaticExportManager
      • addDefaultFileNameToFolder

        public java.lang.String addDefaultFileNameToFolder​(java.lang.String rfsName,
                                                           boolean isFolder)
        Returns the real file system name plus the default file name.

        Parameters:
        rfsName - the real file system name to append the default file name to
        isFolder - signals whether the according virtual file system resource is an folder or not
        Returns:
        the real file system name plus the default file name
      • addExportRule

        public void addExportRule​(java.lang.String name,
                                  java.lang.String description)
        Adds a new export rule to the configuration.

        Parameters:
        name - the name of the rule
        description - the description for the rule
      • addExportRuleRegex

        public void addExportRuleRegex​(java.lang.String regex)
        Adds a regex to the latest export rule.

        Parameters:
        regex - the regex to add
      • addExportRuleUri

        public void addExportRuleUri​(java.lang.String exportUri)
        Adds a export uri to the latest export rule.

        Parameters:
        exportUri - the export uri to add
      • addProtectedExportPoint

        public void addProtectedExportPoint​(java.lang.String uri,
                                            java.lang.String destination)
        Adds an protected export point.

        Parameters:
        uri - the source URI
        destination - the export destination
      • addRfsRule

        public void addRfsRule​(java.lang.String name,
                               java.lang.String description,
                               java.lang.String source,
                               java.lang.String rfsPrefix,
                               java.lang.String exportPath,
                               java.lang.String exportWorkPath,
                               java.lang.String exportBackups,
                               java.lang.String useRelativeLinks)
        Adds a new rfs rule to the configuration.

        Parameters:
        name - the name of the rule
        description - the description for the rule
        source - the source regex
        rfsPrefix - the url prefix
        exportPath - the rfs export path
        exportWorkPath - the rfs export work path
        exportBackups - the number of backups
        useRelativeLinks - the relative links value
      • addRfsRuleSystemRes

        public void addRfsRuleSystemRes​(java.lang.String regex)
        Adds a regex of related system resources to the latest rfs-rule.

        Parameters:
        regex - the regex to add
      • cacheOnlineLink

        public void cacheOnlineLink​(java.lang.String linkName,
                                    java.lang.String vfsName)
        Caches a calculated online link.

        Parameters:
        linkName - the link
        vfsName - the name of the VFS resource
      • cmsEvent

        public void cmsEvent​(CmsEvent event)
        Implements the CmsEvent interface, the static export properties uses the events to clear the list of cached keys in case a project is published.

        Specified by:
        cmsEvent in interface I_CmsEventListener
        Parameters:
        event - CmsEvent that has occurred
      • export

        public int export​(javax.servlet.http.HttpServletRequest req,
                          javax.servlet.http.HttpServletResponse res,
                          CmsObject cms,
                          CmsStaticExportData data)
                   throws CmsException,
                          java.io.IOException,
                          javax.servlet.ServletException,
                          CmsStaticExportException
        Exports the requested uri and at the same time writes the uri to the response output stream if required.

        Parameters:
        req - the current request
        res - the current response
        cms - an initialised cms context (should be initialised with the "Guest" user only)
        data - the static export data set
        Returns:
        status code of the export operation, status codes are the same as http status codes (200,303,304)
        Throws:
        CmsException - in case of errors accessing the VFS
        javax.servlet.ServletException - in case of errors accessing the servlet
        java.io.IOException - in case of errors writing to the export output stream
        CmsStaticExportException - if static export is disabled
      • exportFullStaticRender

        public void exportFullStaticRender​(boolean purgeFirst,
                                           I_CmsReport report)
                                    throws CmsException,
                                           java.io.IOException,
                                           javax.servlet.ServletException
        Starts a complete static export of all resources.

        Parameters:
        purgeFirst - flag to delete all resources in the export folder of the rfs
        report - an I_CmsReport instance to print output message, or null to write messages to the log file
        Throws:
        CmsException - in case of errors accessing the VFS
        java.io.IOException - in case of errors writing to the export output stream
        javax.servlet.ServletException - in case of errors accessing the servlet
      • getAcceptCharsetHeader

        public java.lang.String getAcceptCharsetHeader()
        Returns the accept-charset header used for internal requests.

        Returns:
        the accept-charset header
      • getAcceptLanguageHeader

        public java.lang.String getAcceptLanguageHeader()
        Returns the accept-language header used for internal requests.

        Returns:
        the accept-language header
      • getCachedOnlineLink

        public java.lang.String getCachedOnlineLink​(java.lang.String vfsName)
        Returns a cached link for the given vfs name.

        Parameters:
        vfsName - the name of the vfs resource to get the cached link for
        Returns:
        a cached link for the given vfs name, or null
      • getCacheKey

        public java.lang.String getCacheKey​(java.lang.String siteRoot,
                                            java.lang.String uri)
        Returns the key for the online, export and secure cache.

        Parameters:
        siteRoot - the site root of the resource
        uri - the URI of the resource
        Returns:
        a key for the cache
      • getDefault

        public java.lang.String getDefault()
        Gets the default property value as a string representation.

        Returns:
        "true" or "false"
      • getDefaultAcceptCharsetHeader

        public java.lang.String getDefaultAcceptCharsetHeader()
        Returns the current default charset header.

        Returns:
        the current default charset header
      • getDefaultAcceptLanguageHeader

        public java.lang.String getDefaultAcceptLanguageHeader()
        Returns the current default locale header.

        Returns:
        the current default locale header
      • getDefaultRfsPrefix

        public java.lang.String getDefaultRfsPrefix()
        Returns the default prefix for exported links in the "real" file system.

        Returns:
        the default prefix for exported links in the "real" file system
      • getExportBackups

        public java.lang.Integer getExportBackups()
        Returns the number of stored backups.

        Returns:
        the number of stored backups
      • getExportData

        public CmsStaticExportData getExportData​(javax.servlet.http.HttpServletRequest request,
                                                 CmsObject cms)
        Returns the export data for the request, if null is returned no export is required.

        Parameters:
        request - the request to check for export data
        cms - an initialized cms context (should be initialized with the "Guest" user only
        Returns:
        the export data for the request, if null is returned no export is required
      • getExportEnabled

        public java.lang.String getExportEnabled()
        Gets the export enabled value as a string representation.

        Returns:
        "true" or "false"
      • getExportFolderPatterns

        public java.util.List<java.lang.String> getExportFolderPatterns()
        Returns list of resources patterns which are part of the export.

        Returns:
        the of resources patterns which are part of the export.
      • getExportHeaders

        public java.util.List<java.lang.String> getExportHeaders()
        Returns specific http headers for the static export.

        If the header Cache-Control is set, OpenCms will not use its default headers.

        Returns:
        the list of http export headers
      • getExportnames

        public java.util.Map<CmsExportname,​java.lang.String> getExportnames()
        Returns a map of all export names with export name as key and the vfs folder path as value.

        Returns:
        a map of export names
      • getExportPath

        public java.lang.String getExportPath​(java.lang.String vfsName)
        Returns the export path for the static export, that is the folder where the static exported resources will be written to.

        The returned value will be a directory like prefix. The value is configured in the opencms-importexport.xml configuration file. An optimization of the configured value will be performed, where all relative path information is resolved (for example /export/../static will be resolved to /export. Moreover, if the configured path ends with a /, this will be cut off (for example /export/ becomes /export.

        This is resource name based, and based on the rfs-rules defined in the opencms-importexport.xml configuration file.

        Parameters:
        vfsName - the name of the resource to export
        Returns:
        the export path for the static export, that is the folder where the
        See Also:
        getRfsPrefix(String), getVfsPrefix()
      • getExportPathForConfiguration

        public java.lang.String getExportPathForConfiguration()
        Returns the original configured export path for the static export without the complete rfs path, to be used when re-writing the configuration.

        This is required only to serialize the configuration again exactly as it was configured. This method should not be used otherwise. Use getExportPath(String) to obtain the export path to use when exporting.

        Returns:
        the original configured export path for the static export without the complete rfs path
      • getExportPoints

        public java.util.Set<CmsExportPointgetExportPoints()
        Returns the protected export points.

        Returns:
        the protected export points
      • getExportPropertyDefault

        public boolean getExportPropertyDefault()
        Returns true if the default value for the resource property "export" is true.

        Returns:
        true if the default value for the resource property "export" is true
      • getExportSuffixes

        public java.util.List<java.lang.String> getExportSuffixes()
        Gets the list of resource suffixes which will be exported by default.

        Returns:
        list of resource suffixes
      • getExportUrl

        public java.lang.String getExportUrl()
        Returns the export URL used for internal requests for exporting resources that require a request / response (like JSP).

        Returns:
        the export URL used for internal requests for exporting resources like JSP
      • getExportUrlForConfiguration

        public java.lang.String getExportUrlForConfiguration()
        Returns the export URL used for internal requests with unsubstituted context values, to be used when re-writing the configuration.

        This is required only to serialize the configuration again exactly as it was configured. This method should not be used otherwise. Use getExportUrl() to obtain the export path to use when exporting.

        Returns:
        the export URL used for internal requests with unsubstituted context values
      • getExportUrlPrefix

        public java.lang.String getExportUrlPrefix()
        Returns the export URL used for internal requests for exporting resources that require a request / response (like JSP) without http://servername.

        Returns:
        the export URL used for internal requests for exporting resources like JSP without http://servername
      • getExportWorkPath

        public java.lang.String getExportWorkPath()
        Returns the export work path for the static export, that is the folder where the static exported resources will be written to during the export process.

        Returns:
        the export work path for the static export
      • getExportWorkPathForConfiguration

        public java.lang.String getExportWorkPathForConfiguration()
        Returns the original configured export work path for the static export without the complete rfs path, to be used when re-writing the configuration.

        Returns:
        the original configured export work path for the static export without the complete rfs path
      • getPlainExportOptimization

        public java.lang.String getPlainExportOptimization()
        Gets the plain export optimization value as a string representation.

        Returns:
        "true" or "false"
      • getProtectedExportName

        public java.lang.String getProtectedExportName​(java.lang.String rootPath)
        Returns the protected export name for the given root path.

        Parameters:
        rootPath - the root path
        Returns:
        the protected export name
      • getProtectedExportPath

        public java.lang.String getProtectedExportPath()
        Returns the protected export path.

        Returns:
        the protected export path
      • getProtectedExportPoints

        public java.util.Map<java.lang.String,​java.lang.String> getProtectedExportPoints()
        Returns the protected export points.

        Returns:
        the protected export points
      • getQuickPlainExport

        public boolean getQuickPlainExport()
        Returns true if the quick plain export is enabled.

        Returns:
        true if the quick plain export is enabled
      • getRelativeLinks

        public java.lang.String getRelativeLinks()
        Gets the relative links value as a string representation.

        Returns:
        "true" or "false"
      • getRemoteAddr

        public java.lang.String getRemoteAddr()
        Returns the remote address used for internal requests.

        Returns:
        the remote address
      • getRemoteAddress

        public java.lang.String getRemoteAddress()
        Returns the remote address.

        Returns:
        the remote address
      • getRfsName

        public java.lang.String getRfsName​(CmsObject cms,
                                           java.lang.String vfsName,
                                           java.lang.String parameters,
                                           java.lang.String targetDetailPage)
        Returns the static export rfs name for a given vfs resource where the link to the resource includes request parameters.

        Parameters:
        cms - an initialized cms context
        vfsName - the name of the vfs resource
        parameters - the parameters of the link pointing to the resource
        targetDetailPage - the target detail page to use
        Returns:
        the static export rfs name for a give vfs resource
      • getRfsPrefix

        public java.lang.String getRfsPrefix​(java.lang.String vfsName)
        Returns the prefix for exported links in the "real" file system.

        The returned value will be a directory like prefix. The value is configured in the opencms-importexport.xml configuration file. An optimization of the configured value will be performed, where all relative path information is resolved (for example /export/../static will be resolved to /export. Moreover, if the configured path ends with a /, this will be cut off (for example /export/ becomes /export.

        This is resource name based, and based on the rfs-rules defined in the opencms-importexport.xml configuration file.

        Parameters:
        vfsName - the name of the resource to export
        Returns:
        the prefix for exported links in the "real" file system
        See Also:
        getExportPath(String), getVfsPrefix()
      • getRfsPrefixForConfiguration

        public java.lang.String getRfsPrefixForConfiguration()
        Returns the original configured prefix for exported links in the "real" file, to be used when re-writing the configuration.

        This is required only to serialize the configuration again exactly as it was configured. This method should not be used otherwise. Use getRfsPrefix(String) to obtain the rfs prefix to use for the exported links.

        Returns:
        the original configured prefix for exported links in the "real" file
      • getTestResource

        public java.lang.String getTestResource()
        Returns the vfs name of the test resource.

        Returns:
        the vfs name of the test resource.
      • getVfsExportData

        public CmsStaticExportData getVfsExportData​(CmsObject cms,
                                                    java.lang.String vfsName)
        Returns the export data for a requested resource, if null is returned no export is required.

        Parameters:
        cms - an initialized cms context (should be initialized with the "Guest" user only
        vfsName - the VFS name of the resource requested
        Returns:
        the export data for the request, if null is returned no export is required
      • getVfsName

        public java.lang.String getVfsName​(CmsObject cms,
                                           java.lang.String rfsName)
        Returns the VFS name for the given RFS name, being the exact reverse of getRfsName(CmsObject, String).

        Returns null if no matching VFS resource can be found for the given RFS name.

        Parameters:
        cms - the current users OpenCms context
        rfsName - the RFS name to get the VFS name for
        Returns:
        the VFS name for the given RFS name, or null if the RFS name does not match to the VFS
        See Also:
        getRfsName(CmsObject, String)
      • getVfsPrefix

        public java.lang.String getVfsPrefix()
        Returns the prefix for the internal in the VFS.

        The returned value will be a directory like prefix. The value is configured in the opencms-importexport.xml configuration file. An optimization of the configured value will be performed, where all relative path information is resolved (for example /opencms/../mycms will be resolved to /mycms. Moreover, if the configured path ends with a /, this will be cut off (for example /opencms/ becomes /opencms.

        Returns:
        the prefix for the internal in the VFS
        See Also:
        getExportPath(String), getRfsPrefix(String)
      • getVfsPrefixForConfiguration

        public java.lang.String getVfsPrefixForConfiguration()
        Returns the original configured prefix for internal links in the VFS, to be used when re-writing the configuration.

        This is required only to serialize the configuration again exactly as it was configured. This method should not be used otherwise. Use getVfsPrefix() to obtain the VFS prefix to use for the internal links.

        Returns:
        the original configured prefix for internal links in the VFS
      • initialize

        public void initialize​(CmsObject cms)
        Initializes the static export manager with the OpenCms system configuration.

        Parameters:
        cms - an OpenCms context object
      • isExportLink

        public boolean isExportLink​(CmsObject cms,
                                    java.lang.String vfsName)
        Checks if the static export is required for the given VFS resource.

        Please note that the given OpenCms user context is NOT used to read the resource. The check for export is always done with the permissions of the "Export" user. The provided user context is just used to get the current site root.

        Since the "Export" user always operates in the "Online" project, the resource is also read from the "Online" project, not from the current project of the given OpenCms context.

        Parameters:
        cms - the current users OpenCms context
        vfsName - the VFS resource name to check
        Returns:
        true if static export is required for the given VFS resource
      • isFullStaticExport

        public boolean isFullStaticExport()
        Returns true if the export process is a full static export.

        Returns:
        true if the export process is a full static export
      • isSecureLink

        public boolean isSecureLink​(CmsObject cms,
                                    java.lang.String vfsName)
        Returns true if the given VFS resource should be transported through a secure channel.

        The secure mode is only checked in the "Online" project. If the given OpenCms context is currently not in the "Online" project, false is returned.

        The given resource is read from the site root of the provided OpenCms context.

        Parameters:
        cms - the current users OpenCms context
        vfsName - the VFS resource name to check
        Returns:
        true if the given VFS resource should be transported through a secure channel
        See Also:
        isSecureLink(CmsObject, String, String)
      • isSecureLink

        public boolean isSecureLink​(CmsObject cms,
                                    java.lang.String vfsName,
                                    boolean fromSecure)
        Returns true if the given VFS resource should be transported through a secure channel.

        The secure mode is only checked in the "Online" project. If the given OpenCms context is currently not in the "Online" project, false is returned.

        The given resource is read from the site root of the provided OpenCms context.

        Parameters:
        cms - the current users OpenCms context
        vfsName - the VFS resource name to check
        fromSecure - true if the link source is delivered secure
        Returns:
        true if the given VFS resource should be transported through a secure channel
        See Also:
        isSecureLink(CmsObject, String, String)
      • isSecureLink

        public boolean isSecureLink​(CmsObject cms,
                                    java.lang.String vfsName,
                                    java.lang.String siteRoot)
        Returns true if the given VFS resource that is located under the given site root should be transported through a secure channel.

        Parameters:
        cms - the current users OpenCms context
        vfsName - the VFS resource name to check
        siteRoot - the site root where the the VFS resource should be read
        Returns:
        true if the given VFS resource should be transported through a secure channel
        See Also:
        isSecureLink(CmsObject, String)
      • isSecureLink

        public boolean isSecureLink​(CmsObject cms,
                                    java.lang.String vfsName,
                                    java.lang.String siteRoot,
                                    boolean fromSecure)
        Returns true if the given VFS resource should be transported through a secure channel.

        The secure mode is only checked in the "Online" project. If the given OpenCms context is currently not in the "Online" project, false is returned.

        The given resource is read from the site root of the provided OpenCms context.

        Parameters:
        cms - the current users OpenCms context
        vfsName - the VFS resource name to check
        siteRoot - the site root where the the VFS resource should be read
        fromSecure - true if the link source is delivered secure
        Returns:
        true if the given VFS resource should be transported through a secure channel
        See Also:
        isSecureLink(CmsObject, String, String)
      • isStaticExportEnabled

        public boolean isStaticExportEnabled()
        Returns true if the static export is enabled.

        Returns:
        true if the static export is enabled
      • isSuffixExportable

        public boolean isSuffixExportable​(java.lang.String resourceName)
        Returns true if the given resource name is exportable because of it's suffix.

        Parameters:
        resourceName - the name to check
        Returns:
        true if the given resource name is exportable because of it's suffix
      • isUseTempDir

        public boolean isUseTempDir()
        Checks if we have to use temporary directories during export.

        Returns:
        true if using temporary directories
      • relativeLinksInExport

        public boolean relativeLinksInExport​(java.lang.String vfsName)
        Returns true if the links in the static export should be relative.

        Parameters:
        vfsName - the name of the resource to export
        Returns:
        true if the links in the static export should be relative
      • setAcceptCharsetHeader

        public void setAcceptCharsetHeader​(java.lang.String value)
        Sets the accept-charset header value.

        Parameters:
        value - accept-language header value
      • setAcceptLanguageHeader

        public void setAcceptLanguageHeader​(java.lang.String value)
        Sets the accept-language header value.

        Parameters:
        value - accept-language header value
      • setDefault

        public void setDefault​(java.lang.String value)
        Sets the default property value.

        Parameters:
        value - must be true or false
      • setExportBackups

        public void setExportBackups​(java.lang.String backup)
        Sets the number of backups for the static export.

        Parameters:
        backup - number of backups
      • setExportEnabled

        public void setExportEnabled​(java.lang.String value)
        Sets the export enabled value.

        Parameters:
        value - must be true or false
      • setExportFolderPattern

        public void setExportFolderPattern​(java.lang.String folder)
        Adds a resource pattern to the list of resources which are part of the export.

        Parameters:
        folder - the folder pattern to add to the list.
      • setExportHeader

        public void setExportHeader​(java.lang.String exportHeader)
        Sets specific http header for the static export.

        The format of the headers must be "header:value".

        Parameters:
        exportHeader - a specific http header
      • setExportPath

        public void setExportPath​(java.lang.String path)
        Sets the path where the static export is written.

        Parameters:
        path - the path where the static export is written
      • setExportSuffix

        public void setExportSuffix​(java.lang.String suffix)
        Adds a suffix to the list of resource suffixes which will be exported by default.

        Parameters:
        suffix - the suffix to add to the list.
      • setExportUrl

        public void setExportUrl​(java.lang.String url)
        Sets the export url.

        Parameters:
        url - the export url
      • setExportWorkPath

        public void setExportWorkPath​(java.lang.String path)
        Sets the path where the static export is temporarily written.

        Parameters:
        path - the path where the static export is temporarily written
      • setHandler

        public void setHandler​(java.lang.String handlerClassName)
        Sets the link substitution handler class.

        Parameters:
        handlerClassName - the link substitution handler class name
      • setLinkSubstitutionHandler

        public void setLinkSubstitutionHandler​(java.lang.String handlerClassName)
        Sets the static export handler class.

        Parameters:
        handlerClassName - the static export handler class name
      • setPlainExportOptimization

        public void setPlainExportOptimization​(java.lang.String value)
        Sets the plain export optimization value.

        Parameters:
        value - must be true or false
      • setProtectedExportPath

        public void setProtectedExportPath​(java.lang.String exportPath)
        Sets the protected export path.

        Parameters:
        exportPath - the export path to set
      • setRelativeLinks

        public void setRelativeLinks​(java.lang.String value)
        Sets the relative links value.

        Parameters:
        value - must be true or false
      • setRemoteAddr

        public void setRemoteAddr​(java.lang.String addr)
        Sets the remote address which will be used for internal requests during the static export.

        Parameters:
        addr - the remote address to be used
      • setRfsPrefix

        public void setRfsPrefix​(java.lang.String rfsPrefix)
        Sets the prefix for exported links in the "real" file system.

        Parameters:
        rfsPrefix - the prefix for exported links in the "real" file system
      • setTestResource

        public void setTestResource​(java.lang.String testResource)
        Sets the test resource.

        Parameters:
        testResource - the vfs name of the test resource
      • setVfsPrefix

        public void setVfsPrefix​(java.lang.String vfsPrefix)
        Sets the prefix for internal links in the vfs.

        Parameters:
        vfsPrefix - the prefix for internal links in the vfs
      • shutDown

        public void shutDown()
        Shuts down all this static export manager.

        This is required since there may still be a thread running when the system is being shut down.

      • clearCaches

        protected void clearCaches​(CmsEvent event)
        Clears the caches in the export manager.

        Parameters:
        event - the event that requested to clear the caches
      • createExportBackupFolders

        protected void createExportBackupFolders​(java.io.File staticExport,
                                                 java.lang.String exportPath,
                                                 int exportBackups,
                                                 java.lang.String ruleBackupExtension)
        Creates the backup folders for the given export folder and deletes the oldest if the maximum number is reached.

        Parameters:
        staticExport - folder for which a new backup folder has to be created
        exportPath - export path to create backup path out of it
        exportBackups - number of maximum
        ruleBackupExtension - extension for rule based backups
      • createExportFolder

        protected void createExportFolder​(java.lang.String exportPath,
                                          java.lang.String rfsName)
                                   throws CmsException
        Creates the parent folder for a exported resource in the RFS.

        Parameters:
        exportPath - the path to export the file
        rfsName - the rfs name of the resource
        Throws:
        CmsException - if the folder could not be created
      • getCacheExportLinks

        protected java.util.Map<java.lang.String,​java.lang.Boolean> getCacheExportLinks()
        Returns the cacheExportLinks.

        Returns:
        the cacheExportLinks
      • getCacheSecureLinks

        protected java.util.Map<java.lang.String,​java.lang.String> getCacheSecureLinks()
        Returns the cacheSecureLinks.

        Returns:
        the cacheSecureLinks
      • getRfsExportData

        protected CmsStaticExportData getRfsExportData​(CmsObject cms,
                                                       java.lang.String uri)
        Returns the export data for a requested resource, if null is returned no export is required.

        Parameters:
        cms - an initialized cms context (should be initialized with the "Export" user only)
        uri - the uri, ie RFS name of the requested resource, with or without the 'export' prefix
        Returns:
        the export data for the request, if null is returned no export is required
      • getRfsNameWithExportName

        protected java.lang.String getRfsNameWithExportName​(CmsObject cms,
                                                            java.lang.String vfsName)
        Returns the rfs name for a given vfs name with consideration of the export name.

        Parameters:
        cms - the cms obejct
        vfsName - the the name of the vfs resource
        Returns:
        the rfs name for a given vfs name with consideration of the export name
      • getRfsPrefixForRfsName

        protected java.lang.String getRfsPrefixForRfsName​(java.lang.String rfsName)
        Returns the longest rfs prefix matching a given already translated rfs name.

        Parameters:
        rfsName - the rfs name
        Returns:
        its rfs prefix
        See Also:
        getRfsPrefix(String)
      • insertContextStrings

        protected java.lang.String insertContextStrings​(java.lang.String path)
        Substitutes the ${CONTEXT_NAME} and ${SERVLET_NAME} in a path with the real values.

        Parameters:
        path - the path to substitute
        Returns:
        path with real context values
      • isValidRfsName

        protected boolean isValidRfsName​(java.lang.String rfsName)
        Returns true if the rfs Name match against any of the defined export urls.

        Parameters:
        rfsName - the rfs Name to validate
        Returns:
        true if the rfs Name match against any of the defined export urls
      • isValidURL

        protected boolean isValidURL​(java.lang.String inputString)
        Checks if a String is a valid URL.

        Parameters:
        inputString - The String to check can be null
        Returns:
        true if the String is not null and a valid URL
      • normalizeExportPath

        protected java.lang.String normalizeExportPath​(java.lang.String exportPath)
        Returns a normalized export path.

        Replacing macros, normalizing the path and taking care of relative paths.

        Parameters:
        exportPath - the export path to normalize
        Returns:
        the normalized export path
      • normalizeRfsPrefix

        protected java.lang.String normalizeRfsPrefix​(java.lang.String rfsPrefix)
        Returns a normalized rfs prefix.

        Replacing macros and normalizing the path.

        Parameters:
        rfsPrefix - the prefix to normalize
        Returns:
        the normalized rfs prefix
      • scrubExportFolders

        protected void scrubExportFolders​(I_CmsReport report)
        Scrubs all the "export" folders.

        Parameters:
        report - an I_CmsReport instance to print output message, or null to write messages to the log file
      • writeResource

        protected void writeResource​(javax.servlet.http.HttpServletRequest req,
                                     java.lang.String exportPath,
                                     java.lang.String rfsName,
                                     CmsResource resource,
                                     byte[] content)
                              throws CmsException
        Writes a resource to the given export path with the given rfs name and the given content.

        Parameters:
        req - the current request
        exportPath - the path to export the resource
        rfsName - the rfs name
        resource - the resource
        content - the content
        Throws:
        CmsException - if something goes wrong