On 7/31/2013 16:40, Marius Dumitru Florea wrote:
That link is generated in menuview.vm Velocity
template, using:
$xwiki.getURL($xcontext.user, 'view') so if $xcontext.userReference is
good, then $xcontext.user should be too (double check) and thus the
link should point to the right user profile. Hope this helps, Marius
Thanks Marius. I could verify that there is absolutely nothing wrong
with the $xcontext.user.
The good news is I found the bug.
First of all, if specific domains are used for subwikis, the xwiki.home
parameter must be set, something i just did not know...
Then comes the bug ;)
In XWiki.java @ 4525
-----------------------------------------
public String getURL(DocumentReference documentReference, String action,
String queryString, String anchor,
XWikiContext context)
{
URL url =
context.getURLFactory().createURL(documentReference.getLastSpaceReference().getName(),
documentReference.getName(), action, queryString, anchor,
documentReference.getWikiReference().getName(), context);
return context.getURLFactory().getURL(url, context);
}
-----------------------------------------
So the url variable there is correct, pointing to an absolute url of the
main wiki, then the return statement will convert incorrectly back the
url to a relative path...
The culprit:
XWikiServletURLFactory @ 505
------------------------------------------------------
public String getURL(URL url, XWikiContext context)
{
String relativeURL = "";
try {
if (url != null) {
String surl = url.toString();
if (!surl.startsWith(serverURL.toString())) {
// External URL: leave it as is.
relativeURL = surl;
} else {
.........
}
------------------------------------------------------------
Variables of interest:
surl =
http://wiki.domain.com:8080/bin/view/XWiki/myUser
serverUrl =
http://wiki.domain.com:8080
Note that main wiki is 'http://wiki.domain.com:8080' and subwiki is
'http://rift.wiki.domain.com:8080'
So basically the test if (!surl.startsWith(serverURL.toString())) is
either not sufficient (need to test we are no in the main wiki) or the
serverURL is wrong in case of a subwiki (shouldnt it point to the sub
wiki ??).