String logProperty = facesContext.getExternalContext() .getInitParameter(ENABLE_LOG_CLIENT_PARAMETER);
String logProperty = (String) initParameter .get(ENABLE_LOG_CLIENT_PARAMETER);
    public static void initializeJavaScript(IJavaScriptWriter writer,            IJavaScriptRepository repository,            IHtmlProcessContext renderExternalContext) throws WriterException {        Map requestMap = renderExternalContext.getExternalContext()                .getRequestMap();        if (requestMap.containsKey(JAVASCRIPT_INITIALIZED_PROPERTY)) {            return;        }        LOG.debug("Initializing javascript.");        requestMap.put(JAVASCRIPT_INITIALIZED_PROPERTY, Boolean.TRUE);        writer.writeln(SCRIPT_VERIFY);        FacesContext facesContext = writer.getFacesContext();        IHtmlProcessContext processContext = HtmlProcessContextImpl                .getHtmlProcessContext(facesContext.getExternalContext());        boolean debugMode = processContext.getDebugMode();        if (debugMode) {            writer.writeCall("f_core", "SetDebugMode").writeln("true);");        }        boolean profilerMode = processContext.getProfilerMode();        if (profilerMode) {            writer.writeCall("f_core", "SetProfilerMode").writeln("true);");        }        String invalidBrowserURL = InitializeTag                .getInvalidBrowserURL(facesContext);        if (invalidBrowserURL != null) {            writer.writeCall("f_core", "VerifyBrowserCompatibility")                    .writeString(invalidBrowserURL).writeln(");");        }        boolean flatIdentifier = processContext.isFlatIdentifierEnabled();        if (flatIdentifier) {            writer.writeCall("fa_namingContainer", "SetSeparator").writeln(                    "false);");        } else {            char separator = processContext.getNamingSeparatorChar();            if (separator != NamingContainer.SEPARATOR_CHAR) {                writer.writeCall("fa_namingContainer", "SetSeparator")                        .writeString(String.valueOf(separator)).writeln(");");            }        }        String baseURI = processContext.getExternalContext()                .getRequestContextPath();        writer.writeCall("f_env", "SetBaseURI").writeString(baseURI);        int pred = 0;        String requestURI = AbstractJavaScriptRenderer.getRequestURL(                facesContext, facesContext.getViewRoot());        if (requestURI != null) {            for (; pred > 0; pred--) {                writer.write(',').writeNull();            }            writer.write(',').writeString(requestURI);        } else {            pred++;        }        String jsBaseURI = repository.getBaseURI(processContext);        if (jsBaseURI != null) {            for (; pred > 0; pred--) {                writer.write(',').writeNull();            }            writer.write(',').writeString(jsBaseURI);        } else {            pred++;        }        String styleSheetURI = renderExternalContext.getStyleSheetURI(null);        if (styleSheetURI != null && styleSheetURI.equals(jsBaseURI) == false) {            for (; pred > 0; pred--) {                writer.write(',').writeNull();            }            writer.write(',').writeString(styleSheetURI);        } else {            pred++;        }        writer.writeln(");");        String logProperty = facesContext.getExternalContext()                .getInitParameter(ENABLE_LOG_CLIENT_PARAMETER);        if ("true".equalsIgnoreCase(logProperty)) {            LogService logService = LogHtmlService.getInstance(facesContext);            if (logService != null) {                LogService.IFilter filters[] = logService                        .listFilters(facesContext);                if (filters.length > 0) {                    writer.writeCall("f_log", "AddLevels");                    for (int i = 0; i < filters.length; i++) {                        LogService.IFilter filter = filters[i];                        if (i > 0) {                            writer.write(',');                        }                        writer.writeString(filter.getName());                        writer.write(',');                        writer.writeInt(filter.getLevel());                    }                    writer.writeln(");");                }            }        }        LOG.debug("Javascript initialized.");    }