Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.6
-
Fix Version/s: 1.6.5, 1.7-beta-2
-
Component/s: JSR / TCK / GLS
-
Labels:None
-
Number of attachments :
Description
My use case is that i want to use the same ScriptContext for several scripts which are supposed to shared the same script context but are different script and different output (see http://code.xwiki.org/xwiki/bin/view/Macros/ScriptMacro).
In more details the problem is that GroovyScriptEngineImpl trait the script as something supposed to be used only once and as soon as it set some variables for its internal need it does not take into account anymore provided writer for example. So I can't use the same ScriptContext for two different scripts.
Also I think when i finished executing the script i should not find a "out" binding in my ScriptContext since it's internal groovy use. "context" is a reserved JSR 223 binding but it's not i should not find it either in the ScriptContext after the execution IMO.
Right now i have to clean the ScriptContext to be able to properly reuse it with a new writer.
I have a vague idea about what you want but am not sure of the specifics. Can what you are asking for be expressed in a simple Groovy script calling back into Groovy via JSR-223 or is it tightly coupled to xwiki?
To see if I am slightly on track, can you take a look here:
http://webtest.canoo.com/webtest/manual/scriptStep.html
at the 'keep' attribute and its use in the 'GroovyTrafficLightWithKeepTest' test.
Is this the kind of thing you want but for JSR-223 not BSF? Basically a shared binding or is that not what you want?