public TemplateFactory parseAndCreateTemplateFactory(String templateSource, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { TemplateDocument doc = parseAndCreateTemplateDocument(templateSource, expressionLanguage); try { FragmentList fragments = doc.normalize(); return new ImmutableTemplateFactory(this, fragments); } catch (BehaviorInstantiationException e) { throw new TemplateLoadingException(e); } }
/** * Creates a new TemplateFactory * <p/> * The template lookup is made on the classpath. The template path * should be provided as com/yourcompany/packages/index.html * * @param template The template path * @return Returns the newly created TemplateFactory * @throws TemplateLoadingException */ public TemplateFactory newTemplateFactory(String template, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { InputStream in = classLoader.getResourceAsStream(template); TemplateDocument doc = parseTemplate(in, expressionLanguage); try { FragmentList fragments = doc.normalize(); return new ImmutableTemplateFactory(this, fragments); } catch (BehaviorInstantiationException e) { throw new TemplateLoadingException(e); } }
/** * Creates a new TemplateFactory * <p/> * The template lookup is made on the classpath. The template path * should be provided as com/yourcompany/packages/index.html * * @param template The template path * @param encoding The encoding to be used while parsing the template * @return Returns the newly created TemplateFactory * @throws TemplateLoadingException */ public TemplateFactory newTemplateFactory(String template, String encoding, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { InputStream in = classLoader.getResourceAsStream(template); TemplateDocument doc = parseTemplate(in, encoding, expressionLanguage); try { FragmentList fragments = doc.normalize(); return new ImmutableTemplateFactory(this, fragments); } catch (BehaviorInstantiationException e) { throw new TemplateLoadingException(e); } }
/** * Creates a new TemplateFactory * <p/> * The template lookup is made on the classpath. The template path * should be provided as com/yourcompany/packages/index.html * <p/> * This method also accepts a TemplateModifier which will be called * right after the template parsing finishes. * * @param template The template path * @param modifier The template modifier that will alter the structure of the template * @return Returns the newly created TemplateFactory * @throws TemplateLoadingException */ public TemplateFactory newTemplateFactory(String template, TemplateModifier modifier, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { InputStream in = classLoader.getResourceAsStream(template); TemplateDocument doc = parseTemplate(in, expressionLanguage); modifier.modifyTemplate(doc); try { FragmentList fragments = doc.normalize(); return new ImmutableTemplateFactory(this, fragments); } catch (BehaviorInstantiationException e) { throw new TemplateLoadingException(e); } }
/** * Creates a new TemplateFactory * <p/> * The template lookup is made on the classpath. The template path * should be provided as com/yourcompany/packages/index.html * <p/> * This method also accepts a TemplateModifier which will be called * right after the template parsing finishes. * * @param template The template path * @param encoding The encoding to be used while parsing the template * @param modifier The template modifier that will alter the structure of the template * @return Returns the newly created TemplateFactory * @throws TemplateLoadingException */ public TemplateFactory newTemplateFactory(String template, String encoding, TemplateModifier modifier, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { InputStream in = classLoader.getResourceAsStream(template); TemplateDocument doc = parseTemplate(in, encoding, expressionLanguage); modifier.modifyTemplate(doc); try { FragmentList fragments = doc.normalize(); return new ImmutableTemplateFactory(this, fragments); } catch (BehaviorInstantiationException e) { throw new TemplateLoadingException(e); } }