private String createConfigForSite(CmsSite site, String templateContent) {

        StringTemplate config = new StringTemplate(templateContent);

        // system info
        String webappPath = OpenCms.getSystemInfo().getWebApplicationRfsPath();
        config.setAttribute("DOCUMENT_ROOT", webappPath.substring(0, webappPath.length() - 1));
        config.setAttribute("WEBAPP_NAME", OpenCms.getSystemInfo().getWebApplicationName());
        config.setAttribute("CONTEXT_PATH", OpenCms.getSystemInfo().getContextPath());
        config.setAttribute("SERVLET_PATH", OpenCms.getSystemInfo().getServletPath());
        config.setAttribute("DEFAULT_ENCODING", OpenCms.getSystemInfo().getDefaultEncoding());
        config.setAttribute("CONFIG_FILENAME", generateWebserverConfigName(site.getSiteMatcher(), "_"));
        config.setAttribute("LOGGING_DIRECTORY", m_loggingDir);

        // site info
        config.setAttribute("SERVER_URL", site.getUrl());
        config.setAttribute("SERVER_PROTOCOL", site.getSiteMatcher().getServerProtocol());
        config.setAttribute("SERVER_NAME", site.getSiteMatcher().getServerName());
        config.setAttribute("SERVER_PORT", site.getSiteMatcher().getServerPort());
        config.setAttribute("SERVER_NAME_WITH_PORT", generateWebserverConfigName(site.getSiteMatcher(), ":"));
        config.setAttribute("SITE_TITLE", site.getTitle());
        if (site.getErrorPage() != null) {
            config.setAttribute("ERROR_PAGE", site.getErrorPage());
        }

        // alias info
        if ((site.getAliases() != null) && !site.getAliases().isEmpty()) {
            config.setAttribute("ALIAS_DIRECTIVE", "ServerAlias");
            for (CmsSiteMatcher alias : site.getAliases()) {
                config.setAttribute("SERVER_ALIASES", generateWebserverConfigName(alias, ":") + " ");
            }
        }

        // secure info
        if (site.hasSecureServer()) {
            if (site.getSecureUrl() != null) {
                config.setAttribute("SECURE_URL", site.getSecureUrl());
            }
            if (site.getSecureServer() != null) {
                config.setAttribute("SECURE_SRV_WITH_PORT", generateWebserverConfigName(site.getSecureServer(), ":"));
                config.setAttribute("SECURE_SERVER_NAME", site.getSecureServer().getServerName());
                config.setAttribute("SECURE_SERVER_PORT", site.getSecureServer().getServerPort());
                config.setAttribute("SECURE_SERVER_PROTOCOL", site.getSecureServer().getServerProtocol());
            }
        }
        return config.toString();
    }
private String createConfigForSite ( CmsSite site , String templateContent ) { StringTemplate config = new StringTemplate ( templateContent ) ; String webappPath = OpenCms . getSystemInfo ( ) . getWebApplicationRfsPath ( ) ; config . setAttribute ( "DOCUMENT_ROOT" , webappPath . substring ( 0 , webappPath . length ( ) - 1 ) ) ; config . setAttribute ( "WEBAPP_NAME" , OpenCms . getSystemInfo ( ) . getWebApplicationName ( ) ) ; config . setAttribute ( "CONTEXT_PATH" , OpenCms . getSystemInfo ( ) . getContextPath ( ) ) ; config . setAttribute ( "SERVLET_PATH" , OpenCms . getSystemInfo ( ) . getServletPath ( ) ) ; config . setAttribute ( "DEFAULT_ENCODING" , OpenCms . getSystemInfo ( ) . getDefaultEncoding ( ) ) ; config . setAttribute ( "CONFIG_FILENAME" , generateWebserverConfigName ( site . getSiteMatcher ( ) , "_" ) ) ; config . setAttribute ( "LOGGING_DIRECTORY" , m_loggingDir ) ; config . setAttribute ( "SERVER_URL" , site . getUrl ( ) ) ; config . setAttribute ( "SERVER_PROTOCOL" , site . getSiteMatcher ( ) . getServerProtocol ( ) ) ; config . setAttribute ( "SERVER_NAME" , site . getSiteMatcher ( ) . getServerName ( ) ) ; config . setAttribute ( "SERVER_PORT" , site . getSiteMatcher ( ) . getServerPort ( ) ) ; config . setAttribute ( "SERVER_NAME_WITH_PORT" , generateWebserverConfigName ( site . getSiteMatcher ( ) , ":" ) ) ; config . setAttribute ( "SITE_TITLE" , site . getTitle ( ) ) ; if ( site . getErrorPage ( ) != null ) { config . setAttribute ( "ERROR_PAGE" , site . getErrorPage ( ) ) ; } if ( ( site . getAliases ( ) != null ) && ! site . getAliases ( ) . isEmpty ( ) ) { config . setAttribute ( "ALIAS_DIRECTIVE" , "ServerAlias" ) ; for ( CmsSiteMatcher alias : site . getAliases ( ) ) { config . setAttribute ( "SERVER_ALIASES" , generateWebserverConfigName ( alias , ":" ) + " " ) ; } } if ( site . hasSecureServer ( ) ) { if ( site . getSecureUrl ( ) != null ) { config . setAttribute ( "SECURE_URL" , site . getSecureUrl ( ) ) ; } if ( site . getSecureServer ( ) != null ) { config . setAttribute ( "SECURE_SRV_WITH_PORT" , generateWebserverConfigName ( site . getSecureServer ( ) , ":" ) ) ; config . setAttribute ( "SECURE_SERVER_NAME" , site . getSecureServer ( ) . getServerName ( ) ) ; config . setAttribute ( "SECURE_SERVER_PORT" , site . getSecureServer ( ) . getServerPort ( ) ) ; config . setAttribute ( "SECURE_SERVER_PROTOCOL" , site . getSecureServer ( ) . getServerProtocol ( ) ) ; } } return config . toString ( ) ; }
Performs the template handling and returns the content.<p>

@param site the site
@param templateContent the configuration template content

@return the file content for the configuration as String