Changes for page Release Notes for XWiki Enterprise 4.1
Last modified by Thomas Mortagne on 2017/03/24
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -113,10 +113,52 @@ 113 113 114 114 * New rendering [[Compatibility Test Suite>>rendering:Main.CompatibilityTestSuite]] to make testing easier and simplify implementation of new syntax Parsers and Renderers. You can checkout the [[Compatibility report>>rendering:Main.SyntaxReport]] for all the syntaxes that are supported out of the box by XWiki. 115 115 116 -* New API for upgrading installed XWiki Extensions. 117 - 118 118 * New diff/merge module has been added to make easier to deal with diff and merge both from component and scripts. See [[Diff module >>extensions:Extension.Diff Module]] for details. 119 119 118 +== Easy variable sharing between scripts == 119 +It's now much easier to share variable between languages. 120 +You can now create a variable in a Groovy script and use it in a Velocity script. 121 + 122 +For example:((( 123 +{{code language="none"}} 124 +{{groovy}} 125 +var = "toto" 126 +{{/groovy}} 127 + 128 +{{velocity}} 129 +$var 130 +{{/velocity}} 131 +{{/code}} 132 +))) 133 + 134 +== [[new Script Service allowing to access the Component Manager directly from 135 +scripts>>platform:DevGuide.Scripting||anchor="HXWikiComponentAccess"]] == 136 + 137 +Privileged scripts can now easily load components from the Component Manager (XWiki's dependency injection system). This is not available in Velocity because of it's limited capability to load classes. 138 + 139 +For example:((( 140 +{{code}} 141 +{{groovy}} 142 +def myComponent = services.component.getInstance(MyComponentRole.class) 143 +{{/groovy}} 144 +{{/code}} 145 +))) 146 + 147 +== Velocity scripts can pass enum parameters as Strings == 148 +With the [[new Velocity uberspector>>doc:extensions:Extension.Velocity Module||anchor="HMethodArgumentsUberspector"]], Velocity will convert method arguments in string form to formal parameter types when the passed arguments don't match the method signature. 149 + 150 +For example:((( 151 +{{code}} 152 +$obj.someMethod('VALUE') 153 +// will forward to 154 +obj.someMethod(SomeEnum.VALUE) 155 +// if obj has a method with signature someMethod(SomeEnum) and not someMethod(String) 156 +{{/code}} 157 + 158 +But this is not limited to enums. The conversion is done using the [[Properties Module>>doc:extensions:Extension.Properties Module]] which means you can create and register custom converters for data types specific to your application domain. 159 +))) 160 + 161 + 120 120 == Taming of Groovy scripts == 121 121 122 122 Since traditionally, Groovy scripts can enter into unstoppable infinite loops, use reflection to violate security assumptions, access server resources, or even crash the virtual machine, they have been off limits to non-administrators.