Search in sources :

Example 1 with FaceletsConfiguration

use of com.sun.faces.config.FaceletsConfiguration in project mojarra by eclipse-ee4j.

the class SAXCompiler method writeXmlDecl.

protected static void writeXmlDecl(InputStream is, String encoding, CompilationManager mngr) throws IOException {
    is.mark(128);
    try {
        byte[] b = new byte[128];
        if (is.read(b) > 0) {
            String r = new String(b, encoding);
            Matcher m = XmlDeclaration.matcher(r);
            if (m.find()) {
                WebConfiguration config = mngr.getWebConfiguration();
                FaceletsConfiguration faceletsConfig = config.getFaceletsConfiguration();
                boolean currentModeIsXhtml = faceletsConfig.isProcessCurrentDocumentAsFaceletsXhtml(mngr.getAlias());
                // with the value of XHTML
                if (currentModeIsXhtml) {
                    Util.saveXMLDECLToFacesContextAttributes(m.group(0) + "\n");
                }
            }
        }
    } finally {
        is.reset();
    }
}
Also used : Matcher(java.util.regex.Matcher) FaceletsConfiguration(com.sun.faces.config.FaceletsConfiguration) WebConfiguration(com.sun.faces.config.WebConfiguration)

Aggregations

FaceletsConfiguration (com.sun.faces.config.FaceletsConfiguration)1 WebConfiguration (com.sun.faces.config.WebConfiguration)1 Matcher (java.util.regex.Matcher)1