Class CrafterFreeMarkerTemplateLoader

java.lang.Object
org.craftercms.engine.freemarker.CrafterFreeMarkerTemplateLoader
All Implemented Interfaces:
freemarker.cache.TemplateLoader

public class CrafterFreeMarkerTemplateLoader extends Object implements freemarker.cache.TemplateLoader
Freemarker TemplateLoader similar to SpringTemplateLoader but instead of using Spring Resources, it uses the ContentStoreService.getContent(Context, String).
Author:
Alfonso Vásquez
  • Constructor Details

    • CrafterFreeMarkerTemplateLoader

      public CrafterFreeMarkerTemplateLoader()
  • Method Details

    • setContentStoreService

      public void setContentStoreService(org.craftercms.core.service.ContentStoreService contentStoreService)
    • setGlobalAllowedPaths

      public void setGlobalAllowedPaths(String[] globalAllowedPaths)
    • findTemplateSource

      public Object findTemplateSource(String name) throws IOException
      Specified by:
      findTemplateSource in interface freemarker.cache.TemplateLoader
      Throws:
      IOException
    • getLastModified

      public long getLastModified(Object templateSource)
      Specified by:
      getLastModified in interface freemarker.cache.TemplateLoader
    • getReader

      public Reader getReader(Object templateSource, String encoding) throws IOException
      Specified by:
      getReader in interface freemarker.cache.TemplateLoader
      Throws:
      IOException
    • closeTemplateSource

      public void closeTemplateSource(Object templateSource) throws IOException
      Specified by:
      closeTemplateSource in interface freemarker.cache.TemplateLoader
      Throws:
      IOException
    • getTemplatePath

      protected String getTemplatePath(SiteContext siteContext, String name)