config.setTemplateLoader(createTemplateLoader(templatePath)); } catch (Exception e) { throw new InitParamValueException(INIT_PARAM_TEMPLATE_PATH, templatePath, e);
/** * Overrides {@link FreemarkerServlet#createTemplateLoader(String)} in order to use {@link MultiTemplateLoader} * instead which cascades {@link HstClassTemplateLoader} and {@link org.hippoecm.hst.freemarker.jcr.JcrTemplateLoader} * until it finds a template by the <code>templatePath</code>. */ @Override protected TemplateLoader createTemplateLoader(String templatePath) throws IOException { final String[] prefixExclusions = { FREEMARKER_CLASSPATH_TEMPLATE_PROTOCOL, FREEMARKER_JCR_TEMPLATE_PROTOCOL, FREEMARKER_WEB_FILE_TEMPLATE_PROTOCOL}; final TemplateLoader[] loaders = { new DelegatingTemplateLoader(super.createTemplateLoader(templatePath), null, prefixExclusions), new HstClassTemplateLoader(getClass()), new JcrTemplateLoader(), new WebFileTemplateLoader()}; return new MultiTemplateLoader(loaders); } }
if (templatePath == null) templatePath = "class://"; config.setTemplateLoader(createTemplateLoader(templatePath));
config.setTemplateLoader(createTemplateLoader(templatePath)); } catch (Exception e) { throw new InitParamValueException(INIT_PARAM_TEMPLATE_PATH, templatePath, e);
config.setTemplateLoader(createTemplateLoader(templatePath)); } catch (Exception e) { throw new InitParamValueException(INIT_PARAM_TEMPLATE_PATH, templatePath, e);