public TemplateDocument parseTemplate(File file, String encoding, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { try { return parseTemplate(new FileInputStream(file), encoding, expressionLanguage); } catch (FileNotFoundException e) { throw new TemplateLoadingException(e); } }
@Override public FormTag getInstance() { DynamicTagCreator creator = new DynamicTagCreator(); try { return creator.createTag(FormTag.class.getResourceAsStream("form.html"), FormTag.class, Expressions.cambridgeExpressionLanguage); } catch (TemplateLoadingException e) { e.printStackTrace(); return null; } }
throw new TemplateLoadingException(e); throw new TemplateLoadingException(e);
throw new TemplateLoadingException(e); throw new TemplateLoadingException(e);
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); } }
public TemplateFactory newTemplateFactory(File file, String encoding, TemplateModifier modifier, ExpressionLanguage expressionLanguage) throws TemplateLoadingException { TemplateDocument document = parseTemplate(file, encoding, expressionLanguage); if (modifier != null) { modifier.modifyTemplate(document); } try { if (document.getIncludes() != null) { return new FileTemplateFactory(this, document.normalize(), file, encoding, modifier, getFiles(document.getIncludes()), changeDetectionInterval); } return new FileTemplateFactory(this, document.normalize(), file, encoding, modifier, null, changeDetectionInterval); } catch (BehaviorInstantiationException e) { throw new TemplateLoadingException(e); } }