<
From version < 37.1 >
edited by Jean-Vincent Drean
on 2012/04/11
To version < 38.1 >
edited by Vincent Massol
on 2012/05/18
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.jvdrean
1 +XWiki.VincentMassol
Content
... ... @@ -12,6 +12,32 @@
12 12  * [[Ruby Macro>>extensions:Extension.Ruby Macro]] (not installed by default in XWiki Enterprise)
13 13  * [[PHP Macro>>extensions:Extension.PHP Macro]] (not installed by default in XWiki Enterprise)
14 14  
15 += Choosing a Scripting language =
16 +
17 +Since XWiki supports several scripting languages you might be wondering which one to use.
18 +
19 +The first thing to know is that Velocity is different from the other scripting languages on 2 aspects:
20 +* It's a templating language rather than a pure scripting language, which means that its content is actually wiki markup interspersed with Velocity directives whereas pure scripting languages are written in that language and they need to output wiki markup. For example:(((
21 +Velocity:
22 +
23 +{{code}}
24 +{{velocity}}
25 +Your username is $xcontext.getUser(), welcome to the site.
26 +{{/velocity}}
27 +{{/code}}
28 +
29 +Groovy:
30 +
31 +{{code}}
32 +{{groovy}}
33 +println("Your username is " + xcontext.getUser() + " welcome to the site.");
34 +{{/groovy}}
35 +{{/code}}
36 +)))
37 +* It doesn't require special permissions since it runs in a Sandbox. Other scripting language require the user to have Programming Rights to execute them. Note that starting with XWiki 4.1 we've introduced a [[Sandbox for Groovy>>platform:AdminGuide.Configuration#HSecuringGroovyScripts]] too but it's still in an early stage.
38 +
39 +After taking into account these considerations and if requiring Programming Rights isn't an issue for you, you should pick the script language that you're most familiar with!
40 +
15 15  = XWiki Scripting API =
16 16  
17 17  The API is documented in Javadoc format and can be accessed here: [[XWiki API Javadoc>>DevGuide.API]]. If you are not familiar with Java or object oriented programming, you will probably be confused by the API documentation. It is not within the scope of our documentation to teach you all the details about Java, or object oriented programming. You can find all of that information already online. You can also explore the page code found throughout the [[Extensions wiki>>extensions:Main.WebHome]] area to see how others have figured out how to achieve a variety of results.
... ... @@ -72,7 +72,7 @@
72 72  
73 73  = Velocity Specific Information =
74 74  
75 -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.
101 +Velocity is currently 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.
76 76  
77 77  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).
78 78  

Get Connected