Package freemarker.template

Examples of freemarker.template.Template.process()


    } catch (IOException e) {
      throw new TemplateNotFoundException();
    }
    Writer out = new StringWriter(1024);
    try {
      t.process(model, out);
    } catch (Exception e) {
      throw new JibeRuntimeException("There was an error processing template:" + templateId, e);
    }
    return out.toString();
  }
View Full Code Here


       
        Map<String, TemplateModel> data = new HashMap<String, TemplateModel>();
        data.put("node", new NodeModel(node));

        StringWriter writer = new StringWriter();
        template.process(data, writer);
        return writer.toString();
    }

}
View Full Code Here

        String scriptName = helper.getScript().getScriptResource().getPath();

        try {
            Template tmpl = new Template(scriptName, reader, configuration);
            bindings.put("currentNode", new NodeModel((Node) bindings.get("currentNode")));
            tmpl.process(bindings, scriptContext.getWriter());
        } catch (Throwable t) {
            log.error("Failure running Freemarker script.", t);
            throw new ScriptException("Failure running FreeMarker script "
                + scriptName);
        }
View Full Code Here

                    Template textTemplate = configurer.getConfiguration()
                            .getTemplate(invitationTemplate);
                    final StringWriter textWriter = new StringWriter();

                    textTemplate.process(model, textWriter);

                    message.setText(textWriter.toString(), true);

                    log.info("Inviting: " + invitation.getEmail());
                    log.debug("From: " + from);
View Full Code Here

       
        Template template = config.getTemplate(templateName);
       
        try {
           
            template.process(attributes, response.getWriter());
           
        } catch (TemplateException e) {
            throw new RuntimeException("error processing template : " + templateName, e);
        }
    }
View Full Code Here

    public String render(ModelAndView modelAndView) {
        try {
            StringWriter stringWriter = new StringWriter();

            Template template = configuration.getTemplate(modelAndView.getViewName());
            template.process(modelAndView.getModel(), stringWriter);

            return stringWriter.toString();
        } catch (IOException e) {
            throw new IllegalArgumentException(e);
        } catch (TemplateException e) {
View Full Code Here

        } catch (IOException e) {
            throw new MojoExecutionException("Error reading template: " + templateName, e);
        }

        try {
            template.process(model, writer);
        } catch (freemarker.template.TemplateException e) {
            throw new MojoExecutionException("Error running template: " + templateName, e);
        }

        writer.flush();
View Full Code Here

    } catch (IOException e) {
      throw new TemplateException("Error reading template: " + templateName, e);
    }

    try {
      template.process(model, writer);
    } catch (freemarker.template.TemplateException e) {
      throw new TemplateException("Error running template: " + templateName, e);
    }

    writer.flush();
View Full Code Here

   
  }

  public void writeHtml(Writer out) throws IOException, TemplateException {
    Template template = cfg.getTemplate("diff.html");
    template.process(this, out);
  }

  public List<Diff.ClassDiff> getClassDiffs() {
    return diff.getClassDiffs();
  }
View Full Code Here

  public void write(String templateName, Object report, File file) {
    try {
      Template template = cfg.getTemplate(templateName);
      FileOutputStream os = new FileOutputStream(file);
      OutputStreamWriter out = new OutputStreamWriter(os);
      template.process(report, out);
      out.close();
    } catch (IOException e) {
      throw new RuntimeException(e);
    } catch (TemplateException e) {
      throw new RuntimeException(e);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.