| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfreemarker.cache.URLTemplateLoader
freemarker.cache.ClassTemplateLoader
public class ClassTemplateLoader
A TemplateLoader that uses streams reachable through 
 Class.getResourceAsStream(String) as its source of templates.
| Constructor Summary | |
|---|---|
ClassTemplateLoader()
Deprecated. confusing constructor, and seldom useful; use ClassTemplateLoader(Class, String) instead. | 
|
ClassTemplateLoader(java.lang.Class loaderClass)
Deprecated. it is confusing that the base path is "";
     use ClassTemplateLoader(Class, String) instead. | 
|
ClassTemplateLoader(java.lang.Class loaderClass,
                    java.lang.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). | 
|
| Method Summary | |
|---|---|
protected  java.net.URL | 
getURL(java.lang.String name)
Given a template name (plus potential locale decorations) retrieves an URL that points the template source.  | 
| Methods inherited from class freemarker.cache.URLTemplateLoader | 
|---|
canonicalizePrefix, closeTemplateSource, findTemplateSource, getLastModified, getReader | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public ClassTemplateLoader()
ClassTemplateLoader(Class, String) instead.
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: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.
public ClassTemplateLoader(java.lang.Class loaderClass)
"";
     use ClassTemplateLoader(Class, String) instead.
Class.getResource(String)
 method of the specified class to load the resources, and "" as base
 path. This means that template paths will be resolved relatively to the class
 location, that is, relatively to the directory (package) of the class.
loaderClass - the class whose
 Class.getResource(String) will be used to load the templates.
public ClassTemplateLoader(java.lang.Class loaderClass,
                           java.lang.String path)
Class.getResource(String) method
 of the specified class to load the resources, and the specified base path (absolute or relative).
 Examples:
com.example.myapplication.templates package):new ClassTemplateLoader(
       com.example.myapplication.SomeClass.class,
       "templates")
   new ClassTemplateLoader(
       somepackage.SomeClass.class,
       "/com/example/myapplication/templates")
 
loaderClass - the class whose Class.getResource(String) method will be used
     to load the templates. Be sure that you chose a class whose defining class-loader
     sees the templates. This parameter can't be null.path - the base path to template resources.
     A path that doesn't start with a slash (/) is relative to the
     path (package) of the specified class. A path that starts with a slash
     is an absolute path starting from the root of the package hierarchy. Path
     components should be separated by forward slashes independently of the
     separator character used by the underlying operating system.
     This parameter can't be null.| Method Detail | 
|---|
protected java.net.URL getURL(java.lang.String name)
URLTemplateLoader
getURL in class URLTemplateLoadername - the name of the sought template, including the locale
 decorations.
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||