<
From version < 33.1 >
edited by Thomas Mortagne
on 2011/06/28
To version < 34.1 >
edited by Vincent Massol
on 2011/11/01
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.ThomasMortagne
1 +XWiki.VincentMassol
Content
... ... @@ -29,10 +29,10 @@
29 29  
30 30  == [[XWiki Component>>extensions:Extension.Component Module]] Access ==
31 31  
32 -You can also gain direct access to XWiki components using the following code snippet:
33 -Also see: [[Accessing components from Groovy>>DevGuide.WritingComponents#HAccessingacomponentfromgroovy]]
34 -Note: This snippet is written in Groovy and will have to be converted to your scripting language.
32 +You can also gain direct access to XWiki components using the following code snippet (also see: [[Accessing components from Groovy>>DevGuide.WritingComponents#HAccessingacomponentfromgroovy]]):
35 35  
34 +{{info}}This snippet is written in Groovy and will have to be converted to your scripting language.{{/info}}
35 +
36 36  {{code language="java"}}
37 37  {{groovy}}
38 38  def greeter = com.xpn.xwiki.web.Utils.getComponent(org.xwiki.component.HelloWorld.class);
... ... @@ -42,7 +42,7 @@
42 42  
43 43  == XWiki Core Access ==
44 44  
45 -Sometimes the XWiki Api doesn't provide the methods which you need for your application. you can gain raw access the core of XWiki but it presents an increased security risk and requires programming rights to run. Using the core should be avoided if at all possible.
45 +Sometimes the XWiki Api doesn't provide the methods which you need for your application. You can gain raw access the core of XWiki but it presents an increased security risk and requires **Programming Rights** to be able to save the page containing the script (Programming Rights are not required for viewing a page containing a script requiring Programming Rights, rights are only needed at save time). Using the core should be avoided if at all possible.
46 46  
47 47  {{code language="java"}}
48 48  {{groovy}}
... ... @@ -70,9 +70,10 @@
70 70  
71 71  = Velocity Specific Information =
72 72  
73 -Velocity is the only scripting language which can be used without Administration or Programming [[AdminGuide.Access Rights]]. This means you can save velocity scripts using a username with less permission and an exploit of your script is less of a security breach. Also if you are administrating a [[virtual wiki>>AdminGuide.Virtualization]] and you don't have programming rights, you can still do scripting in Velocity.
74 -You can [[gain access to the XWiki core>>#HXWikiCoreAccess]] from Velocity but this will require programming rights. Strictly speaking, protected APIs are only available when the page that contains them was last saved by someone who has programming rights.
73 +Velocity is the only scripting language which can be used without Programming [[AdminGuide.Access Rights]]. This means you can save velocity scripts using a user with less permission and an exploit of your script is less of a security breach.
75 75  
75 +You can [[gain access to the XWiki core>>#HXWikiCoreAccess]] from Velocity but this will require Programming Rights. Strictly speaking, protected APIs are only available when the page that contains them was last saved by someone who had Programming Rights (see above).
76 +
76 76  In Velocity you can't import classes and as such you cannot gain direct access to XWiki components as shown [[above>>#HXWikiComponentAccess]]. This leaves you with the provided [[bindings>>#HBindings]] (NOTE: In Velocity, these bindings all start with **##$##** as with all other Velocity variables)
77 77  
78 78  For more information about programming in the Velocity language, you can refer to the [[Velocity User Guide>>http://velocity.apache.org/engine/releases/velocity-1.6.2/user-guide.html]].
... ... @@ -151,7 +151,6 @@
151 151  {{/velocity}}
152 152  {{/code}}
153 153  
154 -
155 155  === Information about the current wiki ===
156 156  
157 157  The following variables (set in the [[xwikivars.vm>>http://svn.xwiki.org/svnroot/xwiki/platform/web/trunk/standard/src/main/webapp/templates/xwikivars.vm]] template) are shortcuts for checking various information **about the current wiki**:
... ... @@ -162,7 +162,7 @@
162 162  
163 163  = Groovy Specific Information =
164 164  
165 -Currently all non Velocity scripting languages are only allowed for administrators of a wiki (or users having the 'programming' right).
165 +{{info}}Currently all non Velocity scripting languages are only allowed users having Programming Rights.{{/info}}
166 166  
167 167  * See Groovy examples in the [[Extensions wiki>>extensions:Main.WebHome]]
168 168  * [[Feeling Groovy>>http://www-128.ibm.com/developerworks/java/library/j-alj08034.html]]
... ... @@ -172,7 +172,8 @@
172 172  
173 173  The following example demonstrates how to use a groovy script to interact with velocity code in your page. This example performs a DNS lookup from the velocity variable ##$hostname## and stores the result in the variable ##$address##.
174 174  
175 -Using XWiki Syntax 2.0:
175 +**Using XWiki Syntax 2.0:**
176 +
176 176  Objects can be passed back and forth between scripting languages by storing them in commonly available objects. One such commonly available object which only lasts the length of the request is the context object, known as xcontext.
177 177  
178 178  {{code language="velocity"}}
... ... @@ -193,7 +193,8 @@
193 193  {{/velocity}}
194 194  {{/code}}
195 195  
196 -Using XWiki Syntax 1.0:
197 +**Using XWiki Syntax 1.0:**
198 +
197 197  Because Groovy and Velocity code are parsed together, variables defined in Groovy can be used directly in velocity without storing in and retrieving from the context.
198 198  
199 199  {{code language="velocity"}}
... ... @@ -211,7 +211,7 @@
211 211  
212 212  = Python Specific Information =
213 213  
214 -You can run python code in XWiki just like velocity or groovy.
216 +You can run Python code in XWiki just like Velocity or Groovy.
215 215  
216 216  {{code language="python"}}
217 217  {{python}}

Get Connected