|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfreemarker.cache.URLTemplateLoader
freemarker.cache.ClassTemplateLoader
A TemplateLoader
that uses streams reachable through
Class.getResourceAsStream(String)
as its source of templates.
Constructor Summary | |
ClassTemplateLoader()
Creates a resource template cache that will use its own class to load the resources. |
|
ClassTemplateLoader(java.lang.Class loaderClass)
Creates a resource template cache that will use the specified class to load the resources. |
|
ClassTemplateLoader(java.lang.Class loaderClass,
java.lang.String path)
Creates a resource template cache that will use the specified class to load the resources. |
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()
"/"
.
(But you hardly ever should use the default package as the template
root, so probably you should do something like this:
public ClassTemplateLoader(java.lang.Class loaderClass)
""
meaning templates will be resolved relative to the class location,
that is, relatively to the directory (package) of the class.
(But you hardly ever want to store a Java class in the template root,
so probably you should do something like this:
loaderClass
- the class whose
Class.getResource(String)
will be used to load the templates.public ClassTemplateLoader(java.lang.Class loaderClass, java.lang.String path)
loaderClass
- the class whose
Class.getResource(String)
will be used to load the templates.path
- the base path to template resources.Method Detail |
protected java.net.URL getURL(java.lang.String name)
URLTemplateLoader
getURL
in class URLTemplateLoader
name
- 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 |