Package freemarker.cache

Examples of freemarker.cache.FileTemplateLoader


      if (path.startsWith("class://")) {
        // substring(7) is intentional as we "reuse" the last slash
        loaders.add(new BeangleClassTemplateLoader(path.substring(7)));
      } else if (path.startsWith("file://")) {
        try {
          loaders.add(new FileTemplateLoader(new File(path)));
        } catch (IOException e) {
          throw new RuntimeException("templatePath: " + path + " cannot be accessed", e);
        }
      } else if (path.startsWith("webapp://")) {
        loaders.add(new WebappTemplateLoader(servletContext, path.substring(8)));
View Full Code Here


            // substring(7) is intentional as we "reuse" the last slash
            return new ClassTemplateLoader(getClass(), templatePath.substring(7));
        } else {
            if (templatePath.startsWith("file://")) {
                templatePath = templatePath.substring(7);
                return new FileTemplateLoader(new File(templatePath));
            } else {
                return new WebappTemplateLoader(this.getServletContext(), templatePath);
            }
        }
    }
View Full Code Here

      for (String templatePath : templatesPath) {
        try {
          File file = ResourceUtils.getFile(Application.getClasspathPrefix() + templatePath);
          if (file.exists()) {

            loaders.add(new FileTemplateLoader(file));

          }
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
View Full Code Here

       
        for (int i = 0; i < templatePaths.length; i++) {
          File file = new File(templatePaths[i]);
          if(file.exists() && file.isDirectory()) {
            try {
          loaders.add(new FileTemplateLoader(file));
        }
        catch (IOException e) {
          throw new ExporterException("Problems with templatepath " + file, e);
        }
          } else {
View Full Code Here

            // substring(7) is intentional as we "reuse" the last slash
            return new ClassTemplateLoader(getClass(), templatePath.substring(7));
        } else {
            if (templatePath.startsWith("file://")) {
                templatePath = templatePath.substring(7);
                return new FileTemplateLoader(new File(templatePath));
            } else {
                return new WebappTemplateLoader(this.getServletContext(), templatePath);
            }
        }
    }
View Full Code Here

             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

  private Configuration newFreeMarkerConfiguration() throws IOException {
    final Configuration config = new Configuration();

    final FileTemplateLoader[] templateLoaders = new FileTemplateLoader[templateRootDirs.size()];
    for(int i = 0; i < templateRootDirs.size(); i++) {
      templateLoaders[i] = new FileTemplateLoader((File)templateRootDirs.get(i));
    }
    final MultiTemplateLoader multiTemplateLoader = new MultiTemplateLoader(templateLoaders);

    config.setTemplateLoader(multiTemplateLoader);
    config.setNumberFormat("###############");
View Full Code Here

             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) {
             LOG.error("Invalid template path specified: " + e.getMessage(), e);
         }
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

    public static Configuration newFreeMarkerConfiguration(List<File> templateRootDirs,String defaultEncoding,String templateName) throws IOException {
        Configuration conf = new Configuration();
     
      FileTemplateLoader[] templateLoaders = new FileTemplateLoader[templateRootDirs.size()];
      for(int i = 0; i < templateRootDirs.size(); i++) {
        templateLoaders[i] = new FileTemplateLoader((File)templateRootDirs.get(i));
      }
      MultiTemplateLoader multiTemplateLoader = new MultiTemplateLoader(templateLoaders);
     
      conf.setTemplateLoader(multiTemplateLoader);
      conf.setNumberFormat("###############");
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.