DataHandler merged = null;
try {
freemarker.template.Configuration cfg = new freemarker.template.Configuration();
cfg.setObjectWrapper(new DefaultObjectWrapper());
cfg.setTemplateUpdateDelay(0);
Template temp = new Template(name, new InputStreamReader(src), cfg);
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
Writer out = new OutputStreamWriter(bout);
temp.process(renderContext, out);
out.flush();
merged = new DataHandler(new DataSource() {
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(bout.toByteArray());
}