public class VelocityScriptEngine extends AbstractScriptEngine implements Compilable
| Modifier and Type | Class and Description |
|---|---|
protected static class |
VelocityScriptEngine.SingleResourceReader |
| Modifier and Type | Field and Description |
|---|---|
static String |
VELOCITY_PROPERTIES_KEY
Key used to provide this engine with the pathname of the Velocity properties file.
|
contextARGV, ENGINE, ENGINE_VERSION, FILENAME, LANGUAGE, LANGUAGE_VERSION, NAME| Constructor and Description |
|---|
VelocityScriptEngine()
constructs a new standalone Velocity script engine
|
VelocityScriptEngine(ScriptEngineFactory factory)
constructs a new Velocity script engine, linked to the given factory
|
| Modifier and Type | Method and Description |
|---|---|
CompiledScript |
compile(Reader script)
Compile a template
|
CompiledScript |
compile(String script)
Compile a template
|
Bindings |
createBindings()
creates a new Bindings to be used with this script
|
Object |
eval(Reader reader,
ScriptContext ctx)
Evaluate the given script.
|
Object |
eval(String str,
ScriptContext ctx)
Evaluate the given script.
|
ScriptEngineFactory |
getFactory()
get the factory used to create this script engine
|
protected static String |
getFilename(ScriptContext ctx) |
protected static VelocityContext |
getVelocityContext(ScriptContext ctx) |
protected RuntimeInstance |
getVelocityEngine()
get the internal Velocity RuntimeInstance
|
protected static Properties |
getVelocityProperties(ScriptContext ctx) |
eval, eval, eval, eval, get, getBindings, getContext, getScriptContext, put, setBindings, setContextpublic static final String VELOCITY_PROPERTIES_KEY
public VelocityScriptEngine(ScriptEngineFactory factory)
factory - public VelocityScriptEngine()
protected RuntimeInstance getVelocityEngine()
public Object eval(String str, ScriptContext ctx) throws ScriptException
eval in interface ScriptEnginestr - script sourcectx - script contextScriptExceptionpublic Object eval(Reader reader, ScriptContext ctx) throws ScriptException
eval in interface ScriptEnginereader - script source readerctx - script contextScriptExceptionpublic ScriptEngineFactory getFactory()
getFactory in interface ScriptEnginepublic Bindings createBindings()
createBindings in interface ScriptEngineprotected static VelocityContext getVelocityContext(ScriptContext ctx)
protected static String getFilename(ScriptContext ctx)
protected static Properties getVelocityProperties(ScriptContext ctx)
public CompiledScript compile(String script) throws ScriptException
compile in interface Compilablescript - template sourceScriptExceptionpublic CompiledScript compile(Reader script) throws ScriptException
compile in interface Compilablescript - template sourceScriptExceptionCopyright © 2000–2021 The Apache Software Foundation. All rights reserved.