Class ProtocolBasedDelegatingTemplateLoader

java.lang.Object
org.onehippo.forge.templating.support.handlebars.servlet.ProtocolBasedDelegatingTemplateLoader
All Implemented Interfaces:
com.github.jknack.handlebars.io.TemplateLoader

public class ProtocolBasedDelegatingTemplateLoader extends Object implements com.github.jknack.handlebars.io.TemplateLoader
Protocol based delegating TemplateLoader implementation. For example, if a given template path is "webfile:/a/b/c.hbs", then "webfile:" is regardes as its protocol.
  • Constructor Details

    • ProtocolBasedDelegatingTemplateLoader

      public ProtocolBasedDelegatingTemplateLoader(Map<String,com.github.jknack.handlebars.io.TemplateLoader> protocolTemplateLoadersMap)
      Construct a delegating TemplateLoader based on the given map with pairs of protocol and corresponding delegating TemplateLoader instance
      Parameters:
      protocolTemplateLoadersMap - map with pairs of protocol and corresponding delegating TemplateLoader instance.
  • Method Details

    • sourceAt

      public com.github.jknack.handlebars.io.TemplateSource sourceAt(String location) throws IOException
      Specified by:
      sourceAt in interface com.github.jknack.handlebars.io.TemplateLoader
      Throws:
      IOException
    • resolve

      public String resolve(String location)
      Specified by:
      resolve in interface com.github.jknack.handlebars.io.TemplateLoader
    • getPrefix

      public String getPrefix()
      Specified by:
      getPrefix in interface com.github.jknack.handlebars.io.TemplateLoader
    • getSuffix

      public String getSuffix()
      Specified by:
      getSuffix in interface com.github.jknack.handlebars.io.TemplateLoader
    • setPrefix

      public void setPrefix(String prefix)
      Specified by:
      setPrefix in interface com.github.jknack.handlebars.io.TemplateLoader
    • setSuffix

      public void setSuffix(String suffix)
      Specified by:
      setSuffix in interface com.github.jknack.handlebars.io.TemplateLoader
    • setCharset

      public void setCharset(Charset charset)
      Specified by:
      setCharset in interface com.github.jknack.handlebars.io.TemplateLoader
    • getCharset

      public Charset getCharset()
      Specified by:
      getCharset in interface com.github.jknack.handlebars.io.TemplateLoader