Package freemarker.template

Examples of freemarker.template.Configuration


    private Configuration configuration;
    private Node node;

    public FreemarkerEngineHelper(Node node) {
        configuration = new Configuration();
        this.node = node;
    }
View Full Code Here


    private final Configuration configuration;

    public FreemarkerScriptEngine(ScriptEngineFactory factory) {
        super(factory);
        configuration = new Configuration();
    }
View Full Code Here

    public FreemarkerProcessor(Class<?> templateLoadingFrom) {
        this.templateLoadingFrom = templateLoadingFrom;
    }

    public void process(String resource, Map<String, Object> dataModel, Writer writer) {
        Configuration configuration = configuration();
        try {
            configuration.getTemplate(resource).process(dataModel, writer);
        } catch (Exception e) {
            throw new FreemarkerProcessingFailed(configuration, resource, dataModel, e);
        }
    }
View Full Code Here

            throw new FreemarkerProcessingFailed(configuration, resource, dataModel, e);
        }
    }

    public Configuration configuration() {
        Configuration configuration = new Configuration();
        configuration.setClassForTemplateLoading(templateLoadingFrom, "/");
        configuration.setObjectWrapper(ObjectWrapper.BEANS_WRAPPER);
        return configuration;
    }
View Full Code Here

    @Override
    public void render(HttpServletRequest request, HttpServletResponse response,
            AppProperties properties)
            throws ServletException, IOException {

        Configuration config = (Configuration)properties.getProperty(CONFIG_PROPERTY);
       
        Template template = config.getTemplate(templateName);
       
        try {
           
            template.process(attributes, response.getWriter());
           
View Full Code Here

    @Override
    public void initialize(InitParams initParams, AppResources resources,
            AppPropertyCollector collector) {
       
        String ftlPath = getFTLPath(initParams);
        Configuration config = initFTLConfig(initParams, resources, ftlPath);
        collector.addProperty(FTL.CONFIG_PROPERTY, config);
        readFTLErrorFile(initParams, collector);
    }
View Full Code Here

   
    private Configuration initFTLConfig(InitParams initParams,
            AppResources resources, String ftlPath) {
       
        logger.debug("initializing freemarker Configuration...");
        Configuration config = new Configuration();
        TemplateLoader templateLoader = getTemplateLoader(initParams, resources, ftlPath);
        config.setTemplateLoader(templateLoader);
        config.setObjectWrapper(new DefaultObjectWrapper());
        return config;
    }
View Full Code Here

            new Line(5, "class SumOfPrimes {"),
            new Line(6, "  public void sum() {}"),
            new Line(7, "}")));
      }
    });
    Configuration configuration = new Configuration();
    configuration.setTemplateLoader(new ClassPathTemplateLoader(ReportGeneratorProvider.PREFIX));
    BeansWrapper objectWrapper = new DefaultObjectWrapper();
    configuration.setObjectWrapper(objectWrapper);
    ResourceBundleModel bundleModel = new ResourceBundleModel(getBundle("messages"), objectWrapper);
    model.setMessageBundle(bundleModel);
    generator = new FreemarkerReportGenerator(model, new PrintStream(out),
            "about/Report.html", configuration);
    generator.printHeader();
View Full Code Here

    cost = new ClassCost(getClass().getName(), Arrays.asList(methodCost));
    HtmlReportModel report =
        new HtmlReportModel(costModel, new AnalysisModel(issuesReporter), options);
    BeansWrapper objectWrapper = new DefaultObjectWrapper();
    Configuration configuration = new Configuration();
    configuration.setObjectWrapper(objectWrapper);
    ResourceBundleModel bundleModel = new ResourceBundleModel(getBundle("messages"), objectWrapper);
    configuration.setTemplateLoader(new ClassPathTemplateLoader(ReportGeneratorProvider.PREFIX));
    report.setMessageBundle(bundleModel);
    report.setSourceLinker(new SourceLinkerModel(linker));
    generator = new FreemarkerReportGenerator(report, new PrintStream(out),
        HTML_REPORT_TEMPLATE, configuration);
  }
View Full Code Here

  private final SourceLocation location = new SourceLocation("com/google/Foo.java", 12);

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    Configuration cfg = new Configuration();
    cfg.setTemplateLoader(new ClassPathTemplateLoader(ReportGeneratorProvider.PREFIX));
    BeansWrapper objectWrapper = new DefaultObjectWrapper();
    cfg.setObjectWrapper(objectWrapper);
    ResourceBundleModel messageBundleModel =
        new ResourceBundleModel(ResourceBundle.getBundle("messages"), objectWrapper);
    issueQueue = Lists.newLinkedList();
    template = cfg.getTemplate("costDetailBoxTest.ftl");
    model = new HashMap<String, Object>();
    model.put("message", messageBundleModel);
    model.put("sourceLink", new SourceLinkerModel(new SourceLinker("", "")));
  }
View Full Code Here

TOP

Related Classes of freemarker.template.Configuration

Copyright © 2018 www.massapicom. 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.