An implementation of the
TemplateManager
interface which supports dynamic regeneration
and recompilation of templates as they are changed, much as JSP does.
RecompilingTemplateManager
instances are thread-safe. In your applications, you
generally want exactly one instance of a RecompilingTemplateManager (i.e. a singleton).
Configuration of a
RecompilingTemplateManager
occurs only at construction time, and
is determined by the
RecompilingTemplateManager.Data
object passed to the
constructor. The properties on the
Data
are:
- setSourceDir - determines where the
RecompilingTemplateManager
looks for
template source files. Default is the current directory, which is most likely unsuitable for most
situations.
- setWorkDir - determines where the generated Java source files corresponding to
templates are placed. Default is uniquely generated subdirectory under the directory specified by
the system property java.io.tmpdir.
- setJavaCompiler - determines what program to execute to compile the generated Java
source files. Default is bin/javac (Commands/javac on MacOS) under the
directory specified by the system property java.home.
- setClasspath - used to specify additional components to prepend to the classpath when
compiling generated Java source files. Default is null.
- setClassLoader - used to set the class loader explicitly. Default is use the class
loader of the
RecompilingTemplateManager
instance.