public class FreeMarkerScriptEngine
extends javax.script.AbstractScriptEngine
implements javax.script.Compilable
ScriptEngine
for FreeMarker templates. Supports
compilation by implementing the Compilable
interface for efficient
multiple execution of templates without reparsing. You might want to cast a
generic script engine reference to this class if you want to invoke
FreeMarkerScriptEngine.setConfiguration(Configuration)
to modify its configuration.Modifier and Type | Field and Description |
---|---|
private freemarker.template.Configuration |
config |
private FreeMarkerScriptEngineFactory |
factory |
Constructor and Description |
---|
FreeMarkerScriptEngine(FreeMarkerScriptEngineFactory factory, |
Modifier and Type | Method and Description |
---|---|
javax.script.CompiledScript |
compile(java.io.Reader script) |
javax.script.CompiledScript |
compile(java.lang.String script) |
javax.script.Bindings |
createBindings() |
java.lang.Object |
eval(java.io.Reader script, |
java.lang.Object |
eval(java.lang.String script, |
javax.script.ScriptEngineFactory |
getFactory() |
private void |
checkSetConfiguration() |
void |
setConfiguration(freemarker.template.Configuration config)
Sets a new FreeMarker configuration to use by all templates created by this
script engine factory.
|
FreeMarkerScriptConstants.CONFIGURATION
, but that is also subject
to the same security check and if there are not sufficient privileges, an
eval() or compile() call will also throw a SecurityException.config
- the new FreeMarker configuration objectjava.lang.IllegalArgumentException
- if config is nulljava.lang.SecurityException
- if a security manager is set in the JVM, and the
invoking code doesn't posess the
"freeMarker.script.setEngineConfiguration" runtime permission.createBindings
in interface javax.script.ScriptEngine
eval
in interface javax.script.ScriptEngine
javax.script.ScriptException
eval
in interface javax.script.ScriptEngine
javax.script.ScriptException
getFactory
in interface javax.script.ScriptEngine
compile
in interface javax.script.Compilable
javax.script.ScriptException
compile
in interface javax.script.Compilable
javax.script.ScriptException