Package freemarker.cache

Examples of freemarker.cache.MultiTemplateLoader


        File rootFile = webAppFolder.getAbsoluteFile();
        while (rootFile.getParentFile() != null) {
            rootFile = rootFile.getParentFile();
        }
       
        MultiTemplateLoader mtl;
        TemplateLoader[] loaders = null;

        // ////////// Set the templateLoaders ////////////////
        // if we have a servletContext, then include a webappTemplateLoader
        try {
            if (servletContext != null) {

                WebappTemplateLoader webappTemplateLoader = new WebappTemplateLoader(servletContext);

                TemplateLoader tl = new FileTemplateLoader(rootFile, true);
                loaders = new TemplateLoader[] { tl, webappTemplateLoader };

            } else {
                TemplateLoader tl = new FileTemplateLoader(rootFile, true);
                loaders = new TemplateLoader[] { tl };
            }
        } catch (IOException e) {
            logger.error(e.getMessage());
        }

        if (loaders != null) {
            mtl = new MultiTemplateLoader(loaders);
            conf.setTemplateLoader(mtl);
        }

        // set the BeanWrapper
        conf.setObjectWrapper(BeansWrapper.DEFAULT_WRAPPER);
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 FreeMarkerBundleResourceLoader()
                })
                : new MultiTemplateLoader(new TemplateLoader[]{
                new WebappTemplateLoader(servletContext),
                new StrutsClassTemplateLoader(),
                new FreeMarkerBundleResourceLoader()
        });
    }
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

         }

         // 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

    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

     
      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("###############");
      conf.setBooleanFormat("true,false");
      conf.setDefaultEncoding(defaultEncoding);
View Full Code Here

        loaders.add(0, loader2);
        loaders.add(0, loader1);
      }
      TemplateLoader[] loaders2 = loaders.toArray(new TemplateLoader[loaders.size()]);
      //TemplateLoader loader = new MultiTemplateLoader(new TemplateLoader[]{loader1, loader2});
      TemplateLoader loader = new MultiTemplateLoader(loaders2);
      return loader;
    } catch (IOException e) {
      throw new IllegalArgumentException(e);
    }
  }
View Full Code Here

                    // NOOP
                }

                // Create Factory.
                final Configuration configuration = new Configuration();
                configuration.setTemplateLoader(new MultiTemplateLoader(loaders.toArray(new TemplateLoader[loaders.size()])));
                return configuration;
            }
        });

    }
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 FreeMarkerBundleResourceLoader()
                })
                : new MultiTemplateLoader(new TemplateLoader[]{
                new WebappTemplateLoader(servletContext),
                new StrutsClassTemplateLoader(),
                new FreeMarkerBundleResourceLoader()
        });
    }
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

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.