}
return renderTemplate(template, context, outWriter);
}
public static Environment renderTemplateFromString(String templateString, String templateLocation, Map<String, Object> context, Appendable outWriter, boolean useCache) throws TemplateException, IOException {
Template template = null;
if (useCache){
template = cachedTemplates.get(templateLocation);
}
if (template == null) {
if (useCache){
synchronized (cachedTemplates) {
template = cachedTemplates.get(templateLocation);
if (template == null) {
Reader templateReader = new StringReader(templateString);
template = new Template(templateLocation, templateReader, defaultOfbizConfig);
templateReader.close();
cachedTemplates.put(templateLocation, template);
}
}
} else {
Reader templateReader = new StringReader(templateString);
template = new Template(templateLocation, templateReader, defaultOfbizConfig);
templateReader.close();
}
}
return renderTemplate(template, context, outWriter);