Hi Andreas,
I'm not sure why you would want both the parseGroovyFromPage and the
script in {{groovy}} tags.
The parseGroovyFromPage is intended to instanciate an object from the
class in the page.
Now you can load groovy in groovy so you can have a script in {{groovy}}
tags load a script coming from a page.
If the use case makes sense, it would be needed to strip out the
{{groovy}} tags in the core becore compiling it.
You can try using parseGroovyFromString to do that yourself.
I cannot really help on the GroovyScriptEngineImpl question
Ludovic
Andreas Schaefer a écrit :
When I try to load a Groovy script using
xwiki.parseGroovyFromPage()
then I fail when this Script is enclosed inside '{{groovy}}'. This
means I have to use two different documents when I want to use the
same document to be loaded by XWiki and by xwiki.parseGroovyFromPage()
because one needs the be enclosed by '{{groovy}} and the other can't.
Isn't there a way to remove '{{groovy}}' when parsed so that the
scripts can be used for both?
In addition the 'GroovyScriptEngineImpl' which is used for the Binding
does throw a NoSuchPropertyException when a property is not available.
This makes it cumbersome to test for properties and add them if not
already put inside. For example I need some objects over and over like
'BlogParams' and so I would like to store them inside the bindings. In
order to avoid the exception I either have to catch the Exception
(time consuming) or I need to get the properties map and check if the
property is already added to the map.
Is there a better way to do that?
Cheers - Andy
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Ludovic Dubost
Blog:
http://blog.ludovic.org/
XWiki:
http://www.xwiki.com
Skype: ldubost GTalk: ldubost