java.lang.Object
com.github.jknack.handlebars.io.AbstractTemplateLoader
com.github.jknack.handlebars.io.URLTemplateLoader
com.github.jknack.handlebars.springmvc.SpringTemplateLoader
All Implemented Interfaces:
com.github.jknack.handlebars.io.TemplateLoader

public class SpringTemplateLoader extends com.github.jknack.handlebars.io.URLTemplateLoader
A template loader for a Spring application.
  • Must support fully qualified URLs, e.g. "file:C:/page.html".
  • Must support classpath pseudo-URLs, e.g. "classpath:page.html".
  • Should support relative file paths, e.g. "WEB-INF/page.html".
Since:
0.4.1
Author:
edgar.espina
See Also:
  • ResourceLoader.getResource(String)
  • Field Summary

    Fields inherited from interface com.github.jknack.handlebars.io.TemplateLoader

    DEFAULT_PREFIX, DEFAULT_SUFFIX
  • Constructor Summary

    Constructors
    Constructor
    Description
    SpringTemplateLoader(org.springframework.context.ApplicationContext applicationContext)
    Creates a new SpringTemplateLoader.
    SpringTemplateLoader(org.springframework.core.io.ResourceLoader loader)
    Creates a new SpringTemplateLoader.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected URL
    getResource(String location)
     
    resolve(String location)
     

    Methods inherited from class com.github.jknack.handlebars.io.URLTemplateLoader

    sourceAt

    Methods inherited from class com.github.jknack.handlebars.io.AbstractTemplateLoader

    getCharset, getPrefix, getSuffix, normalize, setCharset, setPrefix, setSuffix

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SpringTemplateLoader

      public SpringTemplateLoader(org.springframework.core.io.ResourceLoader loader)
      Creates a new SpringTemplateLoader.
      Parameters:
      loader - The resource loader. Required.
    • SpringTemplateLoader

      public SpringTemplateLoader(org.springframework.context.ApplicationContext applicationContext)
      Creates a new SpringTemplateLoader.
      Parameters:
      applicationContext - The application's context. Required.
  • Method Details

    • getResource

      protected URL getResource(String location) throws IOException
      Specified by:
      getResource in class com.github.jknack.handlebars.io.URLTemplateLoader
      Throws:
      IOException
    • resolve

      public String resolve(String location)
      Specified by:
      resolve in interface com.github.jknack.handlebars.io.TemplateLoader
      Overrides:
      resolve in class com.github.jknack.handlebars.io.AbstractTemplateLoader