public FaceletHandler doCompile(URL src, String alias) throws IOException { CompilationManager mgr = new CompilationManager(alias, this); CompilationHandler handler = new CompilationHandler(mgr, alias); return doCompile(mgr, handler, src, alias); }
private SAXParser createSAXParser(CompilationHandler handler) throws SAXException, ParserConfigurationException { SAXParserFactory factory = Util.createSAXParserFactory(); factory.setNamespaceAware(true); factory.setFeature("http://xml.org/sax/features/namespace-prefixes", true); factory.setFeature("http://xml.org/sax/features/validation", this .isValidating()); factory.setValidating(this.isValidating()); if (handler.isDisallowDoctypeDeclSet()) { factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", handler.isDisallowDoctypeDecl()); } SAXParser parser = factory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); reader.setErrorHandler(handler); reader.setEntityResolver(handler); return parser; }
protected FaceletHandler doCompile(CompilationManager mngr, CompilationHandler handler, URL src, String alias) throws IOException { String encoding = getEncoding(); try (InputStream is = new BufferedInputStream(src.openStream(), 1024);) { writeXmlDecl(is, encoding, mngr); SAXParser parser = this.createSAXParser(handler); parser.parse(is, handler); } catch (SAXException e) { throw new FaceletException("Error Parsing " + alias + ": " + e.getMessage(), e.getCause()); } catch (ParserConfigurationException e) { throw new FaceletException("Error Configuring Parser " + alias + ": " + e.getMessage(), e.getCause()); } catch (FaceletException e) { throw e; } FaceletHandler result = new EncodingHandler(mngr.createFaceletHandler(), encoding, mngr.getCompilationMessageHolder()); mngr.setCompilationMessageHolder(null); return result; }
@Create public void create() { ApplicationAssociate applicationAssociate = ApplicationAssociate.getCurrentInstance(); if (applicationAssociate != null) { compiler = applicationAssociate.getCompiler(); } else { // TODO: this requires to initialize custom tag library compiler = new SAXCompiler(); } }
protected FaceletHandler doCompile(CompilationManager mngr, CompilationHandler handler, URL src, String alias) throws IOException { String encoding = getEncoding(); try (InputStream is = new BufferedInputStream(src.openStream(), 1024);) { writeXmlDecl(is, encoding, mngr); SAXParser parser = this.createSAXParser(handler); parser.parse(is, handler); } catch (SAXException e) { throw new FaceletException("Error Parsing " + alias + ": " + e.getMessage(), e.getCause()); } catch (ParserConfigurationException e) { throw new FaceletException("Error Configuring Parser " + alias + ": " + e.getMessage(), e.getCause()); } catch (FaceletException e) { throw e; } FaceletHandler result = new EncodingHandler(mngr.createFaceletHandler(), encoding, mngr.getCompilationMessageHolder()); mngr.setCompilationMessageHolder(null); return result; }
protected Compiler createCompiler(Map<String, Object> appMap, WebConfiguration webConfig) { Compiler newCompiler = new SAXCompiler(); loadDecorators(appMap, newCompiler); // Skip params? newCompiler.setTrimmingComments(webConfig.isOptionEnabled(FaceletsSkipComments)); addTagLibraries(newCompiler); return newCompiler; }
String encoding = getEncoding(); try { is = new BufferedInputStream(src.openStream(), 1024); writeXmlDecl(is, encoding, mngr); SAXParser parser = this.createSAXParser(handler); parser.parse(is, handler); } catch (SAXException e) {
protected Compiler createCompiler(Map<String, Object> appMap, WebConfiguration webConfig) { Compiler newCompiler = new SAXCompiler(); loadDecorators(appMap, newCompiler); // Skip params? newCompiler.setTrimmingComments(webConfig.isOptionEnabled(FaceletsSkipComments)); addTagLibraries(newCompiler); return newCompiler; }
public FaceletHandler doMetadataCompile(URL src, String alias) throws IOException { CompilationManager mgr = new CompilationManager("metadata/" + alias, this); CompilationHandler handler = new MetadataCompilationHandler(mgr, alias); return doCompile(mgr, handler, src, alias); }
private SAXParser createSAXParser(CompilationHandler handler) throws SAXException, ParserConfigurationException { SAXParserFactory factory = Util.createSAXParserFactory(); factory.setNamespaceAware(true); factory.setFeature("http://xml.org/sax/features/namespace-prefixes", true); factory.setFeature("http://xml.org/sax/features/validation", this .isValidating()); factory.setValidating(this.isValidating()); if (handler.isDisallowDoctypeDeclSet()) { factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", handler.isDisallowDoctypeDecl()); } SAXParser parser = factory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); reader.setErrorHandler(handler); reader.setEntityResolver(handler); return parser; }
protected FaceletHandler doCompile(CompilationManager mngr, CompilationHandler handler, URL src, String alias) throws IOException { String encoding = getEncoding(); try (InputStream is = new BufferedInputStream(src.openStream(), 1024);) { writeXmlDecl(is, encoding, mngr); SAXParser parser = this.createSAXParser(handler); parser.parse(is, handler); } catch (SAXException e) { throw new FaceletException("Error Parsing " + alias + ": " + e.getMessage(), e.getCause()); } catch (ParserConfigurationException e) { throw new FaceletException("Error Configuring Parser " + alias + ": " + e.getMessage(), e.getCause()); } catch (FaceletException e) { throw e; } FaceletHandler result = new EncodingHandler(mngr.createFaceletHandler(), encoding, mngr.getCompilationMessageHolder()); mngr.setCompilationMessageHolder(null); return result; }
protected Compiler createCompiler(Map<String, Object> appMap, WebConfiguration webConfig) { Compiler newCompiler = new SAXCompiler(); loadDecorators(appMap, newCompiler); // Skip params? newCompiler.setTrimmingComments(webConfig.isOptionEnabled(FaceletsSkipComments)); addTagLibraries(newCompiler); return newCompiler; }
@Override public FaceletHandler doMetadataCompile(URL src, String alias) throws IOException { CompilationManager mgr = new CompilationManager("metadata/" + alias, this); CompilationHandler handler = new MetadataCompilationHandler(mgr, alias); return doCompile(mgr, handler, src, alias); }
private SAXParser createSAXParser(CompilationHandler handler) throws SAXException, ParserConfigurationException { SAXParserFactory factory = Util.createSAXParserFactory(); factory.setNamespaceAware(true); factory.setFeature("http://xml.org/sax/features/namespace-prefixes", true); factory.setFeature("http://xml.org/sax/features/validation", this .isValidating()); factory.setValidating(this.isValidating()); if (handler.isDisallowDoctypeDeclSet()) { factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", handler.isDisallowDoctypeDecl()); } SAXParser parser = factory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); reader.setErrorHandler(handler); reader.setEntityResolver(handler); return parser; }
protected Compiler createCompiler(Map<String, Object> appMap, WebConfiguration webConfig) { Compiler c = new SAXCompiler();
@Override public FaceletHandler doCompile(URL src, String alias) throws IOException { CompilationManager mgr = new CompilationManager(alias, this); CompilationHandler handler = new CompilationHandler(mgr, alias); return doCompile(mgr, handler, src, alias); }
private SAXParser createSAXParser(CompilationHandler handler) throws SAXException, ParserConfigurationException { SAXParserFactory factory = Util.createSAXParserFactory(); factory.setNamespaceAware(true); factory.setFeature("http://xml.org/sax/features/namespace-prefixes", true); factory.setFeature("http://xml.org/sax/features/validation", this .isValidating()); factory.setValidating(this.isValidating()); if (handler.isDisallowDoctypeDeclSet()) { factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", handler.isDisallowDoctypeDecl()); } SAXParser parser = factory.newSAXParser(); XMLReader reader = parser.getXMLReader(); reader.setProperty("http://xml.org/sax/properties/lexical-handler", handler); reader.setErrorHandler(handler); reader.setEntityResolver(handler); return parser; }
@Override public FaceletHandler doMetadataCompile(URL src, String alias) throws IOException { CompilationManager mgr = new CompilationManager("metadata/" + alias, this); CompilationHandler handler = new MetadataCompilationHandler(mgr, alias); return doCompile(mgr, handler, src, alias); }
@Override public FaceletHandler doCompile(URL src, String alias) throws IOException { CompilationManager mgr = new CompilationManager(alias, this); CompilationHandler handler = new CompilationHandler(mgr, alias); return doCompile(mgr, handler, src, alias); }
@Override public FaceletHandler doMetadataCompile(URL src, String alias) throws IOException { CompilationManager mgr = new CompilationManager("metadata/" + alias, this); CompilationHandler handler = new MetadataCompilationHandler(mgr, alias); return doCompile(mgr, handler, src, alias); }