Show last authors
1 {{velocity}}
2 ## This pages serves 3 purposes:
3 ## - Used by the Extension Manager UI to display the extension page for an extension based on the Maven <url> element which are set to http://extensions.xwiki.org/?id=${groupId}:${artifactId}:::...
4 ## - Used by the Javadoc to display external link, which based on the Maven <url> are set to http://extensions.xwiki.org/?id=${groupId}:${artifactId}:::?id=groupid:artifactid:version:::.../apidocs/....html?is-external=true. Also support old Javadoc (pre-6.2) to display external link, which does not have version in URL.
5 ## - Displays the list of extensions (when there's no "id" request parameter) using Extension.WebHome
6 ##
7 #if ("$!request.id" != "")
8 ## Remove the part after ":::" (see top level pom.xml source for explanation as to why)
9 #set ($mid = $stringtool.substringBefore($request.id, ":::"))
10 ## Find out if we receive a link to javadoc
11 #set ($jdoc = $stringtool.substringAfter($request.id, "/apidocs/"))
12 ## Parse module id
13 #set ($pmid = $stringtool.split($mid,":",3))
14 #set ($gid = $pmid[0])
15 #set ($artid = $pmid[1])
16 ## Determine the version
17 #if ($pmid.size() > 2)
18 #set ($version = $pmid[2])
19 #else
20 ## Version is not in the URL and we are targetting Javadoc, so try to get it from the referer
21 #if ($jdoc)
22 #set ($referer = $request.getHeader("Referer"))
23 #if ($referer)
24 #set ($jmod = $stringtool.split($stringtool.substringAfterLast($stringtool.substringBefore($referer, "-javadoc"),"/"),"."))
25 #set ($version = "${stringtool.substringAfterLast($jmod[0],'-')}.${jmod[1]}")
26 #end
27 #end
28 ## No version has been found, use the version of this wiki as a default
29 #if (!$version)
30 #set ($version = $xwiki.version)
31 #end
32 #end
33 ## If we are targetting Javadoc, redirect to it through our nexus, else determine the id of the module
34 #if ($jdoc != "")
35 #set ($gid = $stringtool.replace($gid, ".", "/"))
36 $response.sendRedirect("http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/${gid}/${artid}/${version}/${artid}-${version}-javadoc.jar/!/${jdoc}")
37 #else
38 #set($id = "${gid}:${artid}")
39 #end
40 ## Locate the extension by its id
41 ## Special case, if the id is the one of the top level POM, then redirect to the main wiki
42 #if ($id == "org.xwiki.commons:xwiki-commons")
43 $response.sendRedirect($xwiki.getURL("xwiki:Main.WebHome"))
44 #else
45 #set ($xwql = "where doc.object(ExtensionCode.ExtensionClass).id = '$id'")
46 #set ($result = $services.query.xwql($xwql).execute())
47 #if ($result.size() > 0)
48 $response.sendRedirect($xwiki.getURL($result.get(0)))
49 #else
50 ## Search aliases in older versions
51 #set ($xwql = "where doc.object(ExtensionCode.ExtensionVersionClass).id = '$id'")
52 #set ($result = $services.query.xwql($xwql).execute())
53 #if ($result.size() > 0)
54 $response.sendRedirect($xwiki.getURL($result.get(0)))
55 #else
56 ## Unknown ID, list all extensions
57 {{include document="Extension.WebHome"/}}
58 #end
59 #end
60 #end
61 #else
62 {{include document="Extension.WebHome"/}}
63 #end
64 {{/velocity}}

Get Connected