| java.lang.Object freemarker.cache.URLTemplateLoader freemarker.cache.ClassTemplateLoader
Constructor Summary | |
public | ClassTemplateLoader() Creates a template loader that will use the
Class.getResource(String) method of its own class to load the resources, and "/" as base path. | public | ClassTemplateLoader(Class loaderClass) Creates a template loader that will use the
Class.getResource(String) method of the specified class to load the resources, and "" as base
path. | public | ClassTemplateLoader(Class loaderClass, String path) Creates a template loader that will use the
Class.getResource(String) method
of the specified class to load the resources, and the specified base path (absolute or relative).
Examples:
- Relative base path (will load from the
com.example.myapplication.templates package):
new ClassTemplateLoader(
com.example.myapplication.SomeClass.class,
"templates")
- Absolute base path:
new ClassTemplateLoader(
somepackage.SomeClass.class,
"/com/example/myapplication/templates")
Parameters: loaderClass - the class whose Class.getResource(String) method will be usedto load the templates. |
ClassTemplateLoader | public ClassTemplateLoader()(Code) | | Creates a template loader that will use the
Class.getResource(String) method of its own class to load the resources, and "/" as base path.
This means that that template paths will be resolved relatvively the root package
of the class hierarchy, so you hardly ever should use this constructor, rather do
something like this:
ClassTemplateLoader.ClassTemplateLoader(Class,String)new ClassTemplateLoader(com.example.myapplication.SomeClass.class, "templates") If you extend this class, then the extending class will be used to load
the resources.
Warning: this constructor was malfunctioned prior FreeMarker 2.3.4
-- please update FreeMarker if needed.
ClassTemplateLoader.ClassTemplateLoader(Class,String) |
ClassTemplateLoader | public ClassTemplateLoader(Class loaderClass, String path)(Code) | | Creates a template loader that will use the
Class.getResource(String) method
of the specified class to load the resources, and the specified base path (absolute or relative).
Examples:
- Relative base path (will load from the
com.example.myapplication.templates package):
new ClassTemplateLoader(
com.example.myapplication.SomeClass.class,
"templates")
- Absolute base path:
new ClassTemplateLoader(
somepackage.SomeClass.class,
"/com/example/myapplication/templates")
Parameters: loaderClass - the class whose Class.getResource(String) method will be usedto load the templates. Be sure that you chose a class whose defining class-loadersees the templates. This parameter can't be null . Parameters: path - the base path to template resources.A path that doesn't start with a slash (/) is relative to thepath (package) of the specified class. A path that starts with a slashis an absolute path starting from the root of the package hierarchy. Pathcomponents should be separated by forward slashes independently of theseparator character used by the underlying operating system.This parameter can't be null . |
|
|