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:
-
Mustache
Resource
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetTemplate
(String name) Returns a reader for the template with the supplied name.void
setCharset
(String charSet) Set the charset.void
setResourceLoader
(ResourceLoader resourceLoader) Set the resource loader.
-
Constructor Details
-
MustacheResourceTemplateLoader
public MustacheResourceTemplateLoader() -
MustacheResourceTemplateLoader
-
-
Method Details
-
setCharset
Set the charset.- Parameters:
charSet
- the charset
-
setResourceLoader
Set the resource loader.- Specified by:
setResourceLoader
in interfaceResourceLoaderAware
- Parameters:
resourceLoader
- the resource loader
-
getTemplate
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 interfacecom.samskivert.mustache.Mustache.TemplateLoader
- Throws:
Exception
- if the template could not be loaded for any reason.
-