use of com.outjected.email.api.TemplatingException in project simple-email by codylerum.
the class FreeMarkerTemplate method merge.
@Override
public String merge(Map<String, Object> context) {
rootMap.putAll(context);
StringWriter writer = new StringWriter();
try {
Template t = new Template("mailGenerated", template, configuration);
t.process(rootMap, writer);
} catch (IOException e) {
throw new TemplatingException("Error creating template", e);
} catch (TemplateException e) {
throw new TemplatingException("Error rendering output", e);
}
return writer.toString();
}
use of com.outjected.email.api.TemplatingException in project simple-email by codylerum.
the class VelocityTemplate method merge.
@Override
public String merge(Map<String, Object> context) {
StringWriter writer = new StringWriter();
velocityContext = new VelocityContext(context);
try {
velocityEngine.evaluate(velocityContext, writer, "mailGenerated", template);
} catch (ResourceNotFoundException e) {
throw new TemplatingException("Unable to find template", e);
} catch (ParseErrorException e) {
throw new TemplatingException("Unable to find template", e);
} catch (MethodInvocationException e) {
throw new TemplatingException("Error processing method referenced in context", e);
}
return writer.toString();
}
Aggregations