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