Search in sources :

Example 81 with Template

use of freemarker.template.Template in project paascloud-master by paascloud.

the class OptFreeMarkerServiceImpl method getTemplate.

@Override
public String getTemplate(Map<String, Object> map, String templateLocation) throws IOException, TemplateException {
    Preconditions.checkArgument(PublicUtil.isNotEmpty(templateLocation), "模板不能为空");
    Template t = configuration.getTemplate(templateLocation, "UTF-8");
    return FreeMarkerTemplateUtils.processTemplateIntoString(t, map);
}
Also used : Template(freemarker.template.Template)

Aggregations

Template (freemarker.template.Template)81 StringWriter (java.io.StringWriter)35 IOException (java.io.IOException)34 Configuration (freemarker.template.Configuration)33 HashMap (java.util.HashMap)28 Writer (java.io.Writer)27 TemplateException (freemarker.template.TemplateException)24 OutputStreamWriter (java.io.OutputStreamWriter)13 File (java.io.File)9 Map (java.util.Map)9 ByteArrayOutputStream (java.io.ByteArrayOutputStream)7 SimpleHash (freemarker.template.SimpleHash)6 JSONObject (org.json.JSONObject)6 DefaultObjectWrapper (freemarker.template.DefaultObjectWrapper)5 ThirdEyeAnomalyConfiguration (com.linkedin.thirdeye.anomaly.ThirdEyeAnomalyConfiguration)4 StringTemplateLoader (freemarker.cache.StringTemplateLoader)4 Environment (freemarker.core.Environment)4 BufferedWriter (java.io.BufferedWriter)4 FileOutputStream (java.io.FileOutputStream)4 StringReader (java.io.StringReader)4