Package freemarker.cache

Examples of freemarker.cache.MultiTemplateLoader


        // create template loader
        ClassTemplateLoader loader1 = new ClassTemplateLoader(getClass(), "");
        ClassTemplateLoader loader2 = new ClassTemplateLoader(getClass().getSuperclass(), "");
        TemplateLoader[] loaders = new TemplateLoader[]
        { loader1, loader2 };
        MultiTemplateLoader mLoader = new MultiTemplateLoader(loaders);
        cfg.setTemplateLoader(mLoader);
        logger.debug("created freemarker config");
      }

      // create template parameters
View Full Code Here


    ClassTemplateLoader loader1 = new ClassTemplateLoader(getClass(), "");
    ClassTemplateLoader loader2 = new ClassTemplateLoader(GeneratorHelper.class, "");
    TemplateLoader[] loaders = new TemplateLoader[]
    { loader1, loader2 };
    MultiTemplateLoader mLoader = new MultiTemplateLoader(loaders);
    // cfg.setClassForTemplateLoading( this.getClass(), "" ); // NOTE:
    // without
    cfg.setTemplateLoader(mLoader);

    // the '/' on
View Full Code Here

        // ClassTemplateLoader loader1 = new ClassTemplateLoader(
        // Object.class, "");
        // ClassTemplateLoader loader2 = new ClassTemplateLoader(
        // getClass().getSuperclass(), "");
        MultiTemplateLoader mLoader = new MultiTemplateLoader(
            loaders.toArray(new TemplateLoader[loaders.size()]));
        conf.setTemplateLoader(mLoader);
        logger.debug("created freemarker config");
      }
View Full Code Here

         }

         // presume that most apps will require the class and webapp template loader
         // if people wish to
         return templatePathLoader != null ?
                 new MultiTemplateLoader(new TemplateLoader[]{
                         templatePathLoader,
                         new WebappTemplateLoader(servletContext),
                         new StrutsClassTemplateLoader()
                 })
                 : new MultiTemplateLoader(new TemplateLoader[]{
                 new WebappTemplateLoader(servletContext),
                 new StrutsClassTemplateLoader()
         });
     }
View Full Code Here

            throw new RuntimeException(ioEx);
         }
      }
      loaders.add(new ClassTemplateLoader(loaderConfig.getLoaderClass(), loaderConfig.getBasePath()));
      config = new Configuration();
      config.setTemplateLoader(new MultiTemplateLoader(loaders.toArray(new TemplateLoader[0])));
      config.setObjectWrapper(new DefaultObjectWrapper());
   }
View Full Code Here

    }

    @Override
    public void setServletContext(ServletContext servletContext) {
      Configuration cfg = FreemarkerOutputter.createConfiguration();
      cfg.setTemplateLoader(new MultiTemplateLoader(createLoaders(_locations, servletContext)));
      FreemarkerOutputter.init(servletContext, cfg);
    }
View Full Code Here

            } else {
                throw new IOException("Invalid FreeMarker template config.  Zero split tokens.");
            }
        } else {
            TemplateLoader[] loaders = new TemplateLoader[]{new FileTemplateLoader(), new ContextClassLoaderTemplateLoader()};
            MultiTemplateLoader multiLoader = new MultiTemplateLoader(loaders);

            configuration.setTemplateLoader(multiLoader);
            if(applyTemplateBefore()) {
                defaultTemplate = configuration.getTemplate(config.getResource());
            } else {
View Full Code Here

    public Set<Object> getSingletons() {
        Set<Object> singletons = new HashSet<Object>();
        singletons.addAll(contributedSingletons);

        TemplateLoader[] loadersArray = templateLoaders.toArray(new TemplateLoader[templateLoaders.size()]);
        MultiTemplateLoader templateLoader = new MultiTemplateLoader(loadersArray);
        singletons.add(new FreemarkerViewProcessor(templateLoader));
        return singletons;
    }
View Full Code Here

    this.writer = writer;
    this.configuration = new Configuration();

    FileTemplateLoader fileTemplateLoader = createFileTemplateLoader(templateDirectory);
    this.configuration.setTemplateLoader(
        new MultiTemplateLoader(new TemplateLoader[]{
            fileTemplateLoader,
            new ClassTemplateLoader(getClass(), "/"),
        }));
  }
View Full Code Here

TOP

Related Classes of freemarker.cache.MultiTemplateLoader

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.