use of freemarker.cache.ClassTemplateLoader in project spring-framework by spring-projects.
the class FreeMarkerConfigurer method postProcessTemplateLoaders.
/**
* This implementation registers an additional ClassTemplateLoader
* for the Spring-provided macros, added to the end of the list.
*/
@Override
protected void postProcessTemplateLoaders(List<TemplateLoader> templateLoaders) {
templateLoaders.add(new ClassTemplateLoader(FreeMarkerConfigurer.class, ""));
logger.info("ClassTemplateLoader for Spring macros added to FreeMarker configuration");
}
use of freemarker.cache.ClassTemplateLoader in project camel by apache.
the class FreemarkerEndpointTest method createRouteBuilder.
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() throws Exception {
FreemarkerEndpoint endpoint = new FreemarkerEndpoint();
endpoint.setCamelContext(context);
endpoint.setResourceUri("org/apache/camel/component/freemarker/example.ftl");
Configuration configuraiton = new Configuration();
configuraiton.setTemplateLoader(new ClassTemplateLoader(Resource.class, "/"));
endpoint.setConfiguration(configuraiton);
context.addEndpoint("free", endpoint);
from("direct:a").to("free");
}
};
}
use of freemarker.cache.ClassTemplateLoader in project OpenMEAP by OpenMEAP.
the class FreeMarkerTestUtils method createConfiguration.
public static Configuration createConfiguration(Class<?> clazz, String path) {
Configuration cfg = new Configuration();
cfg.setTemplateLoader(new ClassTemplateLoader(clazz, path));
cfg.setObjectWrapper(new DefaultObjectWrapper());
return cfg;
}
use of freemarker.cache.ClassTemplateLoader in project spring-framework by spring-projects.
the class FreeMarkerConfigurer method postProcessTemplateLoaders.
/**
* This implementation registers an additional ClassTemplateLoader
* for the Spring-provided macros, added to the end of the list.
*/
@Override
protected void postProcessTemplateLoaders(List<TemplateLoader> templateLoaders) {
templateLoaders.add(new ClassTemplateLoader(FreeMarkerConfigurer.class, ""));
logger.info("ClassTemplateLoader for Spring macros added to FreeMarker configuration");
}
use of freemarker.cache.ClassTemplateLoader in project opennms by OpenNMS.
the class ModalInjector method generateModalHtml.
protected static String generateModalHtml(boolean showOnLoad) throws IOException, TemplateException {
Configuration cfg = new Configuration(Configuration.VERSION_2_3_21);
ClassTemplateLoader ctl = new ClassTemplateLoader(ModalInjector.class, "/web");
cfg.setTemplateLoader(ctl);
// Load the template
Template template = cfg.getTemplate("modal.ftl.html");
// Build out model
Map<String, Object> data = Maps.newHashMap();
data.put("showOnLoad", showOnLoad);
// Render to string
Writer out = new StringWriter();
template.process(data, out);
out.flush();
return out.toString();
}
Aggregations