Show last authors
1 {{velocity}}
2 #if ($xcontext.action == 'get')
3 #if ("$!request.get('class')" != '')
4 #set($binding = $services.scriptdoc.getTypeInformation($request.get('class')))
5 #if ($binding)
6 #set ($url = $!binding.getDocLink().toString())
7 #end
8 #end
9 #if ("$!url" == '')
10 #set ($url = $!request.url)
11 #end
12 #if ("$!url" != '' && $regextool.compile('^https?://[^/]*\.xwiki\.org/.*').matcher($url.toLowerCase()).matches())
13 #set($docContent = $xwiki.getURLContent($url))
14 #set($docContentStart =
15 $docContent.indexOf('<!-- ======== START OF CLASS DATA ======== -->'))
16 #set($docContentEnd =
17 $docContent.indexOf('<!-- ========= END OF CLASS DATA ========= -->'))
18 #if($docContentStart != -1 && $docContentEnd != -1)
19 #set($ok = $response.setHeader("Cache-Control", 'private'))
20 #set($ok = $response.setHeader("Pragma", 'cache'))
21 #set($expires = $datetool.date.getTime())
22 #set($expires = $expires+120000)##604800000)
23 #set($expires = $datetool.toDate($expires))
24 #set($ok = $response.setDateHeader("Expires",$expires.getTime()))
25 #set($ok = $response.setContentType("text/html"))
26 #set($ok = $xcontext.setFinished(true))
27 #set($output = $response.getOutputStream())
28 #if ($url != $!request.url)
29 #set($comment = "<!-- $url -->")
30 #set($ok = $output.write($comment.getBytes()))
31 #end
32 #set($ok = $output.write($docContent.substring($docContentStart, $docContentEnd).getBytes()))
33 #end
34 #else
35 (% class="container-fluid" style="font-size:120%" %)(((
36 (% class="row" %)(((
37 )))(% class="row" %)(((
38 (% class="col-sm-6" %)(((
39 {{warning}}On very first load, the right panel could take time to load while the bindings caches are being filled.{{/warning}}
40 )))(% class="col-sm-6" %)(((
41 {{info}}Select a script binding on your right to get more detailed information about it.{{/info}}
42 ))))))
43 (% class="row" %)(((
44 The XWiki Scripting API allows script developers to access the XWiki API Java methods that the XWiki development team consider safe for you to use (i.e. for which backward compatibility is guaranteed). The XWiki Scripting API is directly accessible from your wiki pages using any supported scripting language like Velocity, Groovy, Javascript, Python, Ruby,...
45
46 This documentation is dynamically generated based on the available bindings provided to the running wiki instance, and includes bindings provided by installed extensions. On your right, you have a categorized and searchable list of currently available bindings. Bindings are available in most languages just by their name, but for velocity, the name need to be prefixed by a dollar ($) sign. Some bindings are only available to velocity. When listed, their dollar sign is shown hard black.
47
48 = Bindings categories
49
50 ; $services.localization.render('scriptdoc.kinds.template')
51 : These are just velocity variables initialized in velocity templates used to render the current page. Some of them are very internal, but many are considered API since they provide useful shortcuts and fast access to frequently used information. These are obviously only accessible from velocity scripts, and most of them will only be accurate for velocity script in the content or objects of the requested document.
52
53 ; $services.localization.render('scriptdoc.kinds.velocity')
54 : These ones are mostly convenience tools provided to the velocity scripts to allow advanced manipulation of Java types. These are only accessible to velocity scripts. Other languages does not require those tools or can usually directly access them without these bindings.
55
56 ; $services.localization.render('scriptdoc.kinds.script')
57 : These are mostly contextual bindings for the current request. They provide access to the current request and response, as well as to the current document being rendered, and the overall context of the request like the current user, etc... They also provide access to the initial core API and some legacy services. These bindings are provided to all script languages.
58
59 ; $services.localization.render('scriptdoc.kinds.service')
60 : These are bindings provided to scripts by the XWiki modules. They all have the **\$services** binding as a common entry-point and the list of available services is extensible. This is the new modular way used in XWiki to provide services to scripts. These bindings are provided to all script languages.
61
62 ; $services.localization.render('scriptdoc.kinds.plugin')
63 : These bindings was the old way to provide script services. Like them, they have a common entry point below the **\$xwiki** bindings. While some of them are still very useful, their usage are discouraged, and these services are progressively migrated to the new script services.
64
65 = Deprecated, legacy, internal, and unstable bindings
66
67 The deprecated (% class="label label-warning" %)D(% %), deprecated/legacy (% class="label label-danger" %)D(% %) and internal (% class="label label-primary" %)I(% %) bindings are not displayed by default, and you usually does not need them. But you should always pay attention to the **@Unstable** annotation. When you see code marked with this annotation it means it's a new public API that is still considered unstable and that can change at any time too.
68
69 The deprecated bindings have been replaced by new methods and their usage are discouraged. When also marked legacy, the support of this feature has been moved to legacy packages, that are installed by default, but that could be replaced by non-legacy package to fully remove the feature.
70
71 While documented, the internal bindings are very dangerous to be used. The backward compatibility is not guaranteed over time, even between minor versions. Some of the bindings do not have any meaning or stability at all.
72 ))))))
73 #end
74 #else
75 $xwiki.ssx.use($doc)
76 {{html wiki="true"}}
77 <div javadoc-displayer style="display:none;">
78 <div ng-show='loadFailed'>
79
80 {{error}}
81 **Unable to load the requested documentation**
82 You are suffering from a network failure or the documentation server is experiencing some high load or an unexpected interruption of service.
83 {{/error}}
84
85 </div>
86 <div ng-show='notFound'>
87
88 {{warning}}
89 **Documentation not found**
90 The requested documentation could not be found on the documentation server.
91 {{/warning}}
92
93 </div>
94 </div>
95 {{/html}}
96 #end
97 {{/velocity}}

Scripting API Reference