From version < 14.4 >
edited by Caleb James DeLisle
on 2012/06/18
To version < 14.5 >
edited by Caleb James DeLisle
on 2012/06/18
< >
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -115,6 +115,50 @@
115 115  
116 116  * 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.
117 117  
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 +
118 118  == Taming of Groovy scripts ==
119 119  
120 120  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.

Get Connected