Class MustacheResourceTemplateLoader

java.lang.Object
org.springframework.boot.autoconfigure.mustache.MustacheResourceTemplateLoader
All Implemented Interfaces:
com.samskivert.mustache.Mustache.TemplateLoader, Aware, ResourceLoaderAware

public class MustacheResourceTemplateLoader extends Object implements com.samskivert.mustache.Mustache.TemplateLoader, ResourceLoaderAware
Mustache TemplateLoader implementation that uses a prefix, suffix and the Spring Resource abstraction to load a template from a file, classpath, URL etc. A Mustache.TemplateLoader is needed in the Mustache.Compiler when you want to render partials (i.e. tiles-like features).
Since:
1.2.2
Author:
Dave Syer
See Also:
  • Constructor Details

    • MustacheResourceTemplateLoader

      public MustacheResourceTemplateLoader()
    • MustacheResourceTemplateLoader

      public MustacheResourceTemplateLoader(String prefix, String suffix)
  • Method Details

    • setCharset

      public void setCharset(String charSet)
      Set the charset.
      Parameters:
      charSet - the charset
    • setResourceLoader

      public void setResourceLoader(ResourceLoader resourceLoader)
      Set the resource loader.
      Specified by:
      setResourceLoader in interface ResourceLoaderAware
      Parameters:
      resourceLoader - the resource loader
    • getTemplate

      public Reader getTemplate(String name) throws Exception
      Specified by:
      getTemplate in interface com.samskivert.mustache.Mustache.TemplateLoader
      Throws:
      Exception