A freemarker template loader which can load templates from locations under a GeoServer data directory.
To use this template loader, use the {@link Configuration#setTemplateLoader(TemplateLoader)}method:
Configuration cfg = new Configuration(); cfg.setTemplateLoader( new GeoServerTemplateLoader() ); ... Template template = cfg.getTemplate( "foo.ftl" ); ...
In {@link #findTemplateSource(String)}, the following lookup heuristic is applied to locate a file based on the given path.
- The path relative to '/featureTypes/[featureType]' given that a feature ( {@link #setFeatureType(String)} ) has been set
- The path relative to '/featureTypes'
- The path relative to '/templates'
- The path relative to the calling class with {@link Class#getResource(String)}.
Note: If method 5 succeeds, the resulting template will be copied to the 'templates' directory of the data directory.
@author Justin Deoliveira, The Open Planning Project, jdeolive@openplans.org