public class ScriptSessionImpl extends java.lang.Object implements ScriptSession
IScript.execute(org.apache.tapestry.IRequestCycle, org.apache.tapestry.IScriptProcessor, java.util.Map)
,
the session provides access to output symbols as well as the body and initialization blocks
created by the script tokens.Constructor and Description |
---|
ScriptSessionImpl(org.apache.hivemind.Resource scriptTemplateResource,
IRequestCycle cycle,
IScriptProcessor processor,
ExpressionEvaluator evaluator,
ValueConverter valueConverter,
java.util.Map symbols) |
Modifier and Type | Method and Description |
---|---|
void |
addBodyScript(java.lang.String script)
Adds scripting code to the main body.
|
void |
addExternalScript(org.apache.hivemind.Resource resource)
Adds an external script.
|
void |
addInitializationScript(java.lang.String script)
Adds initialization script.
|
java.lang.Object |
evaluate(java.lang.String expression)
Evaluates an OGNL expression, where the root object for the expression is the
symbols map . |
java.lang.Object |
evaluate(java.lang.String expression,
java.lang.Class desiredType)
Evaluates an expression and coerces the result to a particlar type.
|
IRequestCycle |
getRequestCycle()
Returns the current request cycle.
|
org.apache.hivemind.Resource |
getScriptTemplateResource()
Returns the resource for the script template.
|
java.util.Map |
getSymbols()
Returns the symbols (which may be created or updated during the execution of the script
template).
|
java.lang.String |
getUniqueString(java.lang.String baseValue)
Ensures that the given string is unique.
|
java.lang.String |
toString() |
public ScriptSessionImpl(org.apache.hivemind.Resource scriptTemplateResource, IRequestCycle cycle, IScriptProcessor processor, ExpressionEvaluator evaluator, ValueConverter valueConverter, java.util.Map symbols)
public java.lang.Object evaluate(java.lang.String expression)
ScriptSession
symbols map
.evaluate
in interface ScriptSession
public java.lang.Object evaluate(java.lang.String expression, java.lang.Class desiredType)
ScriptSession
evaluate
in interface ScriptSession
ValueConverter
public org.apache.hivemind.Resource getScriptTemplateResource()
ScriptSession
getScriptTemplateResource
in interface ScriptSession
public java.util.Map getSymbols()
ScriptSession
getSymbols
in interface ScriptSession
public IRequestCycle getRequestCycle()
ScriptSession
getRequestCycle
in interface ScriptSession
public void addBodyScript(java.lang.String script)
IScriptProcessor
Body
component will write the body script contents
just inside the <body>
tag.addBodyScript
in interface IScriptProcessor
public void addExternalScript(org.apache.hivemind.Resource resource)
IScriptProcessor
addExternalScript
in interface IScriptProcessor
public void addInitializationScript(java.lang.String script)
IScriptProcessor
</body> tag).
addInitializationScript
in interface IScriptProcessor
public java.lang.String getUniqueString(java.lang.String baseValue)
IScriptProcessor
getUniqueString
in interface IScriptProcessor
public java.lang.String toString()
toString
in class java.lang.Object