Package freemarker.cache

Examples of freemarker.cache.FileTemplateLoader


             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) {
             if (LOG.isErrorEnabled()) {
                LOG.error("Invalid template path specified: #0", e, e.getMessage());
View Full Code Here


      File templateBaseDir = loaderConfig.getTemplateBaseDir();
      if (templateBaseDir != null)
      {
         try
         {
            loaders.add(new FileTemplateLoader(templateBaseDir));
         }
         catch (IOException ioEx)
         {
            throw new RuntimeException(ioEx);
         }
View Full Code Here

     *
     * @throws IOException
     */
    public GeoServerTemplateLoader(Class caller, GeoServerResourceLoader rl) throws IOException {
        //create a file template loader to delegate to
        fileTemplateLoader = new FileTemplateLoader(rl.getBaseDirectory());

        //grab the catalog and store a reference
        catalog = (Catalog)GeoServerExtensions.bean("catalog");

        //create a class template loader to delegate to
View Full Code Here

      String base = prefixAndBase[1].trim();
      if (SERVLET_CONTEXT.equals(prefix)) {
        templateLoaders.add(new WebappTemplateLoader(servletContext, base));
      } else if (FILE.equals(prefix)) {
        try {
          templateLoaders.add(new FileTemplateLoader(new File(base)));
        } catch (IOException e) {
          throw new OpenGammaRuntimeException("Unable to load Freemarker templates from " + base, e);
        }
      } else {
        throw new OpenGammaRuntimeException("Invalid Freemarker template location: " + location);
View Full Code Here

                templateAfter = new Template("free-marker-template-after", new StringReader(templates[1]), configuration);
            } 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());
View Full Code Here

    public GeoServerTemplateLoader(Class caller, GeoServerDataDirectory dd) throws IOException {
        this.dd = dd;

        //create a file template loader to delegate to
        fileTemplateLoader = new FileTemplateLoader(dd.root());

        //grab the catalog and store a reference
        catalog = (Catalog)GeoServerExtensions.bean("catalog");

        //create a class template loader to delegate to
View Full Code Here

     */
    ClassTemplateLoader classTemplateLoader;

    public AuditTemplateLoader(GeoServerResourceLoader rl) throws IOException {
        // the two delegate loaders
        fileTemplateLoader = new FileTemplateLoader(rl.getBaseDirectory());
        classTemplateLoader = new ClassTemplateLoader(getClass(), "");
    }
View Full Code Here

    this.cfg = new Configuration();
   
    TemplateLoader loader;
   
    try {
      loader = new FileTemplateLoader(new File(configs.getTemplatesPath()));
      cfg.setTemplateLoader(loader);
      if(configs.allowCaching())
        cfg.setCacheStorage(new MruCacheStorage(0, Integer.MAX_VALUE));
      else
        cfg.setCacheStorage(new MruCacheStorage(0, 0));
View Full Code Here

    this.delimiter = delimiter;
    this.delimiterType = delimiterType;
    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

        }));
  }

  private FileTemplateLoader createFileTemplateLoader(File templateDirectory) throws IOException {
    if (templateDirectory == null) {
      return new FileTemplateLoader();
    } else {
      return new FileTemplateLoader(templateDirectory, true);
    }
  }
View Full Code Here

TOP

Related Classes of freemarker.cache.FileTemplateLoader

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.