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
      Description copied from interface: com.samskivert.mustache.Mustache.TemplateLoader
      Returns a reader for the template with the supplied name. Reader will be closed by callee.
      Specified by:
      getTemplate in interface com.samskivert.mustache.Mustache.TemplateLoader
      Throws:
      Exception - if the template could not be loaded for any reason.