Package freemarker.cache

Examples of freemarker.cache.ClassTemplateLoader


  }

  private void initialize() {
    cfg.setDefaultEncoding(outputEncoding);
    cfg.setTemplateLoader(new ClassTemplateLoader(this.getClass(),
        baseTemplatePath));
    try {
      packageTemplate = cfg.getTemplate(packageTemplateName);
    } catch (IOException e) {
      throw new RuntimeException("Error parsing base templates: "
View Full Code Here


                FreemarkerEndpoint endpoint = new FreemarkerEndpoint();
                endpoint.setCamelContext(context);
                endpoint.setResourceUri("org/apache/camel/component/freemarker/example.ftl");

                Configuration configuraiton = new Configuration();
                configuraiton.setTemplateLoader(new ClassTemplateLoader(Resource.class, "/"));
                endpoint.setConfiguration(configuraiton);

                context.addEndpoint("free", endpoint);

                from("direct:a").to("free");
View Full Code Here

    public synchronized Configuration getConfiguraiton() {
        if (configuration == null) {
            configuration = new Configuration();
            // use class template loader using Spring Resource class and / as root in classpath
            configuration.setTemplateLoader(new ClassTemplateLoader(Resource.class, "/"));
        }
        return (Configuration) configuration.clone();
    }
View Full Code Here

    public synchronized Configuration getConfiguraiton() {
        if (configuraiton == null) {
            configuraiton = new Configuration();
            // use class template loader using Spring Resource class and / as root in classpath
            configuraiton.setTemplateLoader(new ClassTemplateLoader(Resource.class, "/"));
        }
        return (Configuration) configuraiton.clone();
    }
View Full Code Here

        // Templates are stored in the / directory of the Web app.
        WebappTemplateLoader webloader = new WebappTemplateLoader(servletContext);

        // Templates are stored in the root of the classpath.
        ClassTemplateLoader classLoader = new ClassTemplateLoader(getClass(), "/");
        TemplateLoader[] loaders = new TemplateLoader[] { webloader, classLoader };
        MultiTemplateLoader multiLoader = new MultiTemplateLoader(loaders);

        configuration.setTemplateLoader(multiLoader);
View Full Code Here

        // Templates are stored in the / directory of the Web app.
        WebappTemplateLoader webloader = new WebappTemplateLoader(servletContext);

        // Templates are stored in the root of the classpath.
        ClassTemplateLoader classLoader = new ClassTemplateLoader(getClass(), "/");
        TemplateLoader[] loaders = new TemplateLoader[] { webloader, classLoader };
        MultiTemplateLoader multiLoader = new MultiTemplateLoader(loaders);

        configuration.setTemplateLoader(multiLoader);
View Full Code Here

  private Configuration cfg;

  public FreemarkerConfiguration() {
    cfg = new Configuration();
    ClassTemplateLoader loader = new ClassTemplateLoader(getClass(), "/templates/");
    cfg.setTemplateLoader(loader);
  }
View Full Code Here

  private final Configuration cfg;

  public FreemarkerConfiguration() {
    cfg = new Configuration();
    ClassTemplateLoader loader = new ClassTemplateLoader(getClass(), "/templates/");
    cfg.setTemplateLoader(loader);
    cfg.setDefaultEncoding("UTF-8");
  }
View Full Code Here

   
    public SharedFreemarker() {
        fmConfig.setTemplateLoader(
                new MultiTemplateLoader(
                        new TemplateLoader[]{
                                new ClassTemplateLoader( getClass(), "/")}) );
        fmConfig.setNumberFormat( "0" );
        fmConfig.setLocalizedLookup( false );
        fmConfig.setTemplateUpdateDelay(0);
    }
View Full Code Here

         try {
             if(templatePath!=null){
                 if (templatePath.startsWith("class://")) {
                     // substring(7) is intentional as we "reuse" the last slash
                     templatePathLoader = new ClassTemplateLoader(getClass(), templatePath.substring(7));
                 } else if (templatePath.startsWith("file://")) {
                     templatePathLoader = new FileTemplateLoader(new File(templatePath.substring(7)));
                 }
             }
         } catch (IOException e) {
View Full Code Here

TOP

Related Classes of freemarker.cache.ClassTemplateLoader

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.