Package freemarker.core

Examples of freemarker.core.Environment.process()


  @Override
  public void render() throws IOException, TemplateException {
    PrintWriter writer = response.getWriter();
    Environment processingEnv = template.createProcessingEnvironment(root, writer);
    processingEnv.setOutputEncoding("UTF-8");
    processingEnv.process();
    writer.flush();

    result.nothing();
  }
View Full Code Here


  @Override
  public String getContent() throws IOException, TemplateException {
    StringWriter writer = new StringWriter();
    Environment processingEnv = template.createProcessingEnvironment(root, writer);
    processingEnv.setOutputEncoding("UTF-8");
    processingEnv.process();
    writer.flush();

    return writer.getBuffer().toString();
  }
}
View Full Code Here

        // FIXME: the casting from Appendable to Writer is a temporary fix that could cause a
        //        run time error if in the future we will pass a different class to the method
        //        (such as a StringBuffer).
        Environment env = template.createProcessingEnvironment(context, (Writer)outWriter);
        applyUserSettings(env, context);
        env.process();
    }
   
    public static void addAllOfbizTransforms(Map<String, Object> context) {
        BeansWrapper wrapper = BeansWrapper.getDefaultInstance();
        TemplateHashModel staticModels = wrapper.getStaticModels();
View Full Code Here

  public void generatePropertiesClass(PropertiesClass propertiesClass, Writer out) throws IOException, TemplateException {
    Template template = cfg.getTemplate("properties_class.ftl");
    Environment env = template.createProcessingEnvironment(propertiesClass, out);
    env.setOutputEncoding(OUTPUT_CHARSET);
    env.process();
  }

  public File generateJangarooClass(PropertiesClass pl) {
    File outputFile = PropcHelper.computeGeneratedPropertiesClassFile(locations, pl.getResourceBundle().getFullClassName(), pl.getLocale());
   
View Full Code Here

    cfg.setClassForTemplateLoading(ExmlConfigPackage.class, "/");
    cfg.setObjectWrapper(new DefaultObjectWrapper());
    Template template = cfg.getTemplate("/net/jangaroo/exml/templates/exml_config_package_xsd.ftl");
    Environment env = template.createProcessingEnvironment(suite, output);
    env.setOutputEncoding(Exmlc.OUTPUT_CHARSET);
    env.process();
  }

}
View Full Code Here

    cfg.setClassForTemplateLoading(ConfigClass.class, "/");
    cfg.setObjectWrapper(new DefaultObjectWrapper());
    Template template = cfg.getTemplate("/net/jangaroo/exml/templates/exml_config_class.ftl");
    Environment env = template.createProcessingEnvironment(configClass, output);
    env.setOutputEncoding(Exmlc.OUTPUT_CHARSET);
    env.process();
  }

}
View Full Code Here

    cfg.setObjectWrapper(new DefaultObjectWrapper());
    Template template = cfg.getTemplate("/net/jangaroo/exml/templates/exml_component_class.ftl");
    ExmlComponentClassModel exmlComponentClassModel = new ExmlComponentClassModel(model);
    Environment env = template.createProcessingEnvironment(exmlComponentClassModel, output);
    env.setOutputEncoding(Exmlc.OUTPUT_CHARSET);
    env.process();
  }

  public File generateClass(final ExmlModel model, File result) throws IOException, TemplateException {
    Writer writer = null;
    try {
View Full Code Here

    {
        Environment env = createProcessingEnvironment(dataModel, out, wrapper);
        if (rootNode != null) {
            env.setCurrentVisitorNode(rootNode);
        }
        env.process();
    }
   
    /**
     * Like {@link #process(Object, Writer)}, but overrides the {@link Configuration#getObjectWrapper()}.
     *
 
View Full Code Here

    {
        Environment env = createProcessingEnvironment(rootMap, out, wrapper);
        if (rootNode != null) {
            env.setCurrentVisitorNode(rootNode);
        }
        env.process();
    }
   
    /**
     * Processes the template, using data from the root map object, and outputs
     * the resulting text to the supplied writer, using the supplied
View Full Code Here

        try {
          Template template = conf.getTemplate(templateName);
          if(isLastTemplate) {
            Environment env = template.createProcessingEnvironment(rootMap, writer);
            env.getCurrentNamespace().putAll(globalContext);
            env.process();
          }else {
            Writer tempOutput = new StringWriter(bufferSize);
            Environment env = template.createProcessingEnvironment(rootMap, tempOutput);
            env.getCurrentNamespace().putAll(globalContext);
            env.process();
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.