public class VelocityScriptEngine
extends javax.script.AbstractScriptEngine
implements javax.script.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.
|
Constructor and Description |
---|
VelocityScriptEngine()
constructs a new standalone Velocity script engine
|
VelocityScriptEngine(javax.script.ScriptEngineFactory factory)
contructs a new Velocity script engine, linked to the given factory
|
Modifier and Type | Method and Description |
---|---|
javax.script.CompiledScript |
compile(Reader script)
Compile a template
|
javax.script.CompiledScript |
compile(String script)
Compile a template
|
javax.script.Bindings |
createBindings()
creates a new Bindings to be used with this script
|
Object |
eval(Reader reader,
javax.script.ScriptContext ctx)
Evaluate the given script.
|
Object |
eval(String str,
javax.script.ScriptContext ctx)
Evaluate the given script.
|
javax.script.ScriptEngineFactory |
getFactory()
get the factory used to create this script engine
|
protected static String |
getFilename(javax.script.ScriptContext ctx) |
protected static VelocityContext |
getVelocityContext(javax.script.ScriptContext ctx) |
protected RuntimeInstance |
getVelocityEngine()
get the internal Velocity RuntimeInstance
|
protected static Properties |
getVelocityProperties(javax.script.ScriptContext ctx) |
public static final String VELOCITY_PROPERTIES_KEY
public VelocityScriptEngine(javax.script.ScriptEngineFactory factory)
factory
- public VelocityScriptEngine()
protected RuntimeInstance getVelocityEngine()
public Object eval(String str, javax.script.ScriptContext ctx) throws javax.script.ScriptException
eval
in interface javax.script.ScriptEngine
str
- script sourcectx
- script contextjavax.script.ScriptException
public Object eval(Reader reader, javax.script.ScriptContext ctx) throws javax.script.ScriptException
eval
in interface javax.script.ScriptEngine
reader
- script source readerctx
- script contextjavax.script.ScriptException
public javax.script.ScriptEngineFactory getFactory()
getFactory
in interface javax.script.ScriptEngine
public javax.script.Bindings createBindings()
createBindings
in interface javax.script.ScriptEngine
protected static VelocityContext getVelocityContext(javax.script.ScriptContext ctx)
protected static String getFilename(javax.script.ScriptContext ctx)
protected static Properties getVelocityProperties(javax.script.ScriptContext ctx)
public javax.script.CompiledScript compile(String script) throws javax.script.ScriptException
compile
in interface javax.script.Compilable
script
- template sourcejavax.script.ScriptException
public javax.script.CompiledScript compile(Reader script) throws javax.script.ScriptException
compile
in interface javax.script.Compilable
script
- template sourcejavax.script.ScriptException
Copyright © 2000–2016 The Apache Software Foundation. All rights reserved.