[xwiki-devs] Bug with global user profile in sub wiki and support for empty servlet path
Hi All, I sent 2 emails to the users list without much success and I am hoping that I might find a more suitable audience for my somewhat technical issues with the devs. 1) Global users in sub wiki. In the system I am trying to setup, all the users are created using a custom auth module in the main wiki (Global users), so there will be no local users. The issue is that on a sub wiki, when you click on a user to bring up its profile, you end up on a document not found. From the auth module, the principal returned is prefixed with the 'XWiki.' so the system should be able to differentiate between local and global users and act accordingly. I checked that I could reproduce the issue even if i am not using any custom authentication. Should i log this as a bug in Jira ? 2) Empty servlet path support The second thing I am struggling with is shortening the urls. I am following this guide:
But no matter what I try, I cannot make it work without the '/bin/ prefix. Please note that the xwiki is running under Jetty as the main context (mapped as '/') so the url I have is: server.com/WebHome which according to the short urls document should work. it appears that the issue comes from StandardXWikiURLFactory: -------------------- String type = extendedURL.getSegments().get(0); if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) { xwikiURL = this.entityURLFactory.createURL(extendedURL, parameters); } else { throw new UnsupportedURLException(String.format("URL type [%s] are not yet supported!", type)); } ---------------- So basically for server.com/WebHome, what is happening is that type above equals to "WebHome" and so the condition obviously fails and throws the UnsupportedURLException. Given the above code, I am either forgetting something in the xwiki.cfg or it simply cannot work out of the box... If i were to provide my own custom XWikiUrlFactory, would it solve entirely the issue or some other parts of the system will nevertheless fails because they have the same assumption regarding the presence of the bin or the PathPrefix in the url ? Thanks in advance for your help ! -- Chris
On Mon, Jul 29, 2013 at 12:08 PM, Christian Meunier <[email protected]> wrote:
Hi All,
I sent 2 emails to the users list without much success and I am hoping that I might find a more suitable audience for my somewhat technical issues with the devs.
1) Global users in sub wiki.
In the system I am trying to setup, all the users are created using a custom auth module in the main wiki (Global users), so there will be no local users. The issue is that on a sub wiki, when you click on a user to bring up its profile, you end up on a document not found.
From the auth module, the principal returned is prefixed with the 'XWiki.' so the system should be able to differentiate between local and global users and act accordingly.
'XWiki' is the space name, and you have this space both in the local and the global wiki. In order to make sure the user is from the global wiki you need to use the full/absolute user reference: wiki:XWiki.userName. So your auth module should return something like xwiki:XWIki.mflorea, where 'xwiki' is the main wiki, and 'mflorea' is the user alias used to login. On the Java side you should use the DocumentReference and the DocumentReferenceSerializer.
I checked that I could reproduce the issue even if i am not using any custom authentication.
Should i log this as a bug in Jira ?
2) Empty servlet path support
The second thing I am struggling with is shortening the urls. I am following this guide:
But no matter what I try, I cannot make it work without the '/bin/ prefix. Please note that the xwiki is running under Jetty as the main context (mapped as '/') so the url I have is: server.com/WebHome which according to the short urls document should work.
it appears that the issue comes from StandardXWikiURLFactory: -------------------- String type = extendedURL.getSegments().get(0); if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) { xwikiURL = this.entityURLFactory.createURL(extendedURL, parameters); } else { throw new UnsupportedURLException(String.format("URL type [%s] are not yet supported!", type)); } ----------------
What version of XWiki are you using? I think some changes have been made to the URL "parsing" code in 5.1. Vincent, WDYT? Thanks, Marius
So basically for server.com/WebHome, what is happening is that type above equals to "WebHome" and so the condition obviously fails and throws the UnsupportedURLException. Given the above code, I am either forgetting something in the xwiki.cfg or it simply cannot work out of the box...
If i were to provide my own custom XWikiUrlFactory, would it solve entirely the issue or some other parts of the system will nevertheless fails because they have the same assumption regarding the presence of the bin or the PathPrefix in the url ?
Thanks in advance for your help !
-- Chris _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On 7/29/2013 17:21, Marius Dumitru Florea wrote:
On Mon, Jul 29, 2013 at 12:08 PM, Christian Meunier <[email protected]> wrote:
Hi All,
I sent 2 emails to the users list without much success and I am hoping that I might find a more suitable audience for my somewhat technical issues with the devs.
1) Global users in sub wiki.
In the system I am trying to setup, all the users are created using a custom auth module in the main wiki (Global users), so there will be no local users. The issue is that on a sub wiki, when you click on a user to bring up its profile, you end up on a document not found.
From the auth module, the principal returned is prefixed with the 'XWiki.' so the system should be able to differentiate between local and global users and act accordingly. 'XWiki' is the space name, and you have this space both in the local and the global wiki. In order to make sure the user is from the global wiki you need to use the full/absolute user reference: wiki:XWiki.userName. So your auth module should return something like xwiki:XWIki.mflorea, where 'xwiki' is the main wiki, and 'mflorea' is the user alias used to login. On the Java side you should use the DocumentReference and the DocumentReferenceSerializer.
My bad, actually I am already doing that (Used the custom http auth module as foundation for my own module) String validUserName = username; String validUserFullName = "XWiki." + validUserName; if (context.isMainWiki()) { return new SimplePrincipal(validUserFullName); } else { return new SimplePrincipal(context.getMainXWiki() + ":" + validUserFullName);} } So in case of a sub wiki, I do return "xwiki:XWiki.mflorea" already. Just checked with a remote debugger to be sure.
I checked that I could reproduce the issue even if i am not using any custom authentication.
Should i log this as a bug in Jira ?
2) Empty servlet path support
The second thing I am struggling with is shortening the urls. I am following this guide:
http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs But no matter what I try, I cannot make it work without the '/bin/ prefix. Please note that the xwiki is running under Jetty as the main context (mapped as '/') so the url I have is: server.com/WebHome which according to the short urls document should work.
it appears that the issue comes from StandardXWikiURLFactory: -------------------- String type = extendedURL.getSegments().get(0); if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) { xwikiURL = this.entityURLFactory.createURL(extendedURL, parameters); } else { throw new UnsupportedURLException(String.format("URL type [%s] are not yet supported!", type)); } ----------------
What version of XWiki are you using? I think some changes have been made to the URL "parsing" code in 5.1. Vincent, WDYT? I am using XWiki Enterprise 5.1
Thanks, Marius
Thanks a lot for your replay Marius ! -- Chris
On Mon, Jul 29, 2013 at 12:47 PM, Christian Meunier <[email protected]> wrote:
On 7/29/2013 17:21, Marius Dumitru Florea wrote:
On Mon, Jul 29, 2013 at 12:08 PM, Christian Meunier <[email protected]> wrote:
Hi All,
I sent 2 emails to the users list without much success and I am hoping that I might find a more suitable audience for my somewhat technical issues with the devs.
1) Global users in sub wiki.
In the system I am trying to setup, all the users are created using a custom auth module in the main wiki (Global users), so there will be no local users. The issue is that on a sub wiki, when you click on a user to bring up its profile, you end up on a document not found.
From the auth module, the principal returned is prefixed with the 'XWiki.' so the system should be able to differentiate between local and global users and act accordingly.
'XWiki' is the space name, and you have this space both in the local and the global wiki. In order to make sure the user is from the global wiki you need to use the full/absolute user reference: wiki:XWiki.userName. So your auth module should return something like xwiki:XWIki.mflorea, where 'xwiki' is the main wiki, and 'mflorea' is the user alias used to login. On the Java side you should use the DocumentReference and the DocumentReferenceSerializer.
My bad, actually I am already doing that (Used the custom http auth module as foundation for my own module)
String validUserName = username; String validUserFullName = "XWiki." + validUserName;
if (context.isMainWiki()) { return new SimplePrincipal(validUserFullName); } else { return new SimplePrincipal(context.getMainXWiki() + ":" + validUserFullName);} }
So in case of a sub wiki, I do return "xwiki:XWiki.mflorea" already. Just checked with a remote debugger to be sure.
Ok, can you check if $xcontext.userReference is good? (points to the main wiki?). Also, when you say "click on a user to bring up its profile" is this a link that you generate in the content of a document or the current user profile link from the top left corner (at the end of the top menu)? I would investigate how this link is generated. Hope this helps, Marius
I checked that I could reproduce the issue even if i am not using any custom authentication.
Should i log this as a bug in Jira ?
2) Empty servlet path support
The second thing I am struggling with is shortening the urls. I am following this guide:
But no matter what I try, I cannot make it work without the '/bin/ prefix. Please note that the xwiki is running under Jetty as the main context (mapped as '/') so the url I have is: server.com/WebHome which according to the short urls document should work.
it appears that the issue comes from StandardXWikiURLFactory: -------------------- String type = extendedURL.getSegments().get(0); if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) { xwikiURL = this.entityURLFactory.createURL(extendedURL, parameters); } else { throw new UnsupportedURLException(String.format("URL type [%s] are not yet supported!", type)); } ----------------
What version of XWiki are you using? I think some changes have been made to the URL "parsing" code in 5.1. Vincent, WDYT?
I am using XWiki Enterprise 5.1
Thanks, Marius
Thanks a lot for your replay Marius !
-- Chris _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On 7/29/2013 17:57, Marius Dumitru Florea wrote:
My bad, actually I am already doing that (Used the custom http auth module as foundation for my own module)
String validUserName = username; String validUserFullName = "XWiki." + validUserName;
if (context.isMainWiki()) { return new SimplePrincipal(validUserFullName); } else { return new SimplePrincipal(context.getMainXWiki() + ":" + validUserFullName);} }
So in case of a sub wiki, I do return "xwiki:XWiki.mflorea" already. Just checked with a remote debugger to be sure. Ok, can you check if $xcontext.userReference is good? (points to the main wiki?). Also, when you say "click on a user to bring up its profile" is this a link that you generate in the content of a document or the current user profile link from the top left corner (at the end of the top menu)? I would investigate how this link is generated.
Hope this helps, Marius
Sure thing, being new to xwiki, can you point me to how I can check that ? Is it just a velocity reference I should try to put in any given page ? As for click on a user, basically I just edited a page in the sandbox area of the sub wiki with a global user. Then the activity stream is picking up the change and I click on the user from there. Note than If I load the modified page, the last modified by XXX is pointing to the same URL as the activity stream, so it does not look like to be local to the activity stream component. -- Chris
On Mon, Jul 29, 2013 at 1:05 PM, Christian Meunier <[email protected]> wrote:
On 7/29/2013 17:57, Marius Dumitru Florea wrote:
My bad, actually I am already doing that (Used the custom http auth module as foundation for my own module)
String validUserName = username; String validUserFullName = "XWiki." + validUserName;
if (context.isMainWiki()) { return new SimplePrincipal(validUserFullName); } else { return new SimplePrincipal(context.getMainXWiki() + ":" + validUserFullName);} }
So in case of a sub wiki, I do return "xwiki:XWiki.mflorea" already. Just checked with a remote debugger to be sure. Ok, can you check if $xcontext.userReference is good? (points to the main wiki?). Also, when you say "click on a user to bring up its profile" is this a link that you generate in the content of a document or the current user profile link from the top left corner (at the end of the top menu)? I would investigate how this link is generated.
Hope this helps, Marius
Sure thing, being new to xwiki, can you point me to how I can check that ? Is it just a velocity reference I should try to put in any given page ?
Yes ----------8<---------- {{velocity}} $xcontext.userReference {{/velocity}} ---------->8---------- Hope this helps, Marius
As for click on a user, basically I just edited a page in the sandbox area of the sub wiki with a global user. Then the activity stream is picking up the change and I click on the user from there. Note than If I load the modified page, the last modified by XXX is pointing to the same URL as the activity stream, so it does not look like to be local to the activity stream component.
-- Chris
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On 7/29/2013 18:13, Marius Dumitru Florea wrote:
On Mon, Jul 29, 2013 at 1:05 PM, Christian Meunier <[email protected]> wrote:
On 7/29/2013 17:57, Marius Dumitru Florea wrote:
My bad, actually I am already doing that (Used the custom http auth module as foundation for my own module)
String validUserName = username; String validUserFullName = "XWiki." + validUserName;
if (context.isMainWiki()) { return new SimplePrincipal(validUserFullName); } else { return new SimplePrincipal(context.getMainXWiki() + ":" + validUserFullName);} }
So in case of a sub wiki, I do return "xwiki:XWiki.mflorea" already. Just checked with a remote debugger to be sure. Ok, can you check if $xcontext.userReference is good? (points to the main wiki?). Also, when you say "click on a user to bring up its profile" is this a link that you generate in the content of a document or the current user profile link from the top left corner (at the end of the top menu)? I would investigate how this link is generated.
Hope this helps, Marius
So the user reference is good, value for global user jelan is: 'xwiki:XWiki.Jelan' I also re tested this with a blank wiki restoring the default web.xml and xwiki.cfg (I edited for the shor urls) Only 2 things I edited in the cfg file are as follow: --------------------------------------------- xwiki.virtual.usepath=0 (virtual wikis have different domain names) xwiki.webapppath=
To follow up on this matter, how xwiki is supposed to handle this case ? Is there any provision to display global user profile from within a sub wiki ? What is the expected url ? Thanks -- Chris
Ok, can you check if $xcontext.userReference is good? (points to the main wiki?). Also, when you say "click on a user to bring up its profile" is this a link that you generate in the content of a document or the current user profile link from the top left corner (at the end of the top menu)? I would investigate how this link is generated. Hope this helps, Marius
Forgot to report that the current user profile link from the top left corner is displaying the same issue so at least it does not work anywhere which would means the issue is factored in one place hopefully. -- Chris
On Mon, Jul 29, 2013 at 1:08 PM, Christian Meunier <[email protected]> wrote:
Ok, can you check if $xcontext.userReference is good? (points to the main wiki?). Also, when you say "click on a user to bring up its profile" is this a link that you generate in the content of a document or the current user profile link from the top left corner (at the end of the top menu)? I would investigate how this link is generated. Hope this helps, Marius
Forgot to report that the current user profile link from the top left corner is displaying the same issue so at least it does not work anywhere which would means the issue is factored in one place hopefully.
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
-- Chris _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
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 ??).
Unfortunately, the fix is not as trivial as I originally planned given how XWiki works with the url factory. I assumed the url in the case of a subwiki ressources would be relative and absolute to the subwiki but it is always normalized after the main wiki so the wiki reference of the document being linked is lost and there is no way right now to fix this by just touching this method I believe, as the context does not have anything useful to figure out correctly what to do... The solution seems to not set the wiki.home so the urls reflect the domain they are coming from however then the following fails: XWikiServletURLFactory @ 179: ------------------------------------------------------------ public URL getServerURL(String xwikidb, XWikiContext context) throws MalformedURLException { if (xwikidb == null || xwikidb.equals(context.getOriginalDatabase())) { // This is the case if we are getting a URL for a page which is in // the same wiki as the page which is now being displayed. return this.serverURL; } if (context.isMainWiki(xwikidb)) { // Not in the same wiki so we are in a subwiki and we want a URL which points to the main wiki. // if xwiki.home is set then lets return that. final URL homeParam = getXWikiHomeParameter(context); if (homeParam != null) { return homeParam; } } URL url = context.getWiki().getServerURL(xwikidb, context); return url == null ? this.serverURL : url; } ---------------------------------------------------------------------- Since wiki.home is not set, the method fails to return an url pointing to the main wiki....
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 ??). _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
We had the same issue on xwiki.org when we upgraded to 5.1 but in our case removing the xwiki.home setting worked. We reported and fixed http://jira.xwiki.org/browse/XWIKI-9333 . Make sure all your wikis (including the main wiki) have a proper wiki descriptor. If it still doesn't work the maybe you can try Thomas' fix https://github.com/xwiki/xwiki-platform/commit/0a5d76f408b2404444a7241a79f10... (patch xwiki-platform-oldcore then build it and also xwiki-platform-legacy-oldcore, and use the jar of the later in WEB-INF/lib). Hope this helps, Marius On Thu, Aug 1, 2013 at 8:54 PM, Christian Meunier <[email protected]> wrote:
Unfortunately, the fix is not as trivial as I originally planned given how XWiki works with the url factory.
I assumed the url in the case of a subwiki ressources would be relative and absolute to the subwiki but it is always normalized after the main wiki so the wiki reference of the document being linked is lost and there is no way right now to fix this by just touching this method I believe, as the context does not have anything useful to figure out correctly what to do...
The solution seems to not set the wiki.home so the urls reflect the domain they are coming from however then the following fails:
XWikiServletURLFactory @ 179: ------------------------------------------------------------ public URL getServerURL(String xwikidb, XWikiContext context) throws MalformedURLException { if (xwikidb == null || xwikidb.equals(context.getOriginalDatabase())) { // This is the case if we are getting a URL for a page which is in // the same wiki as the page which is now being displayed. return this.serverURL; }
if (context.isMainWiki(xwikidb)) { // Not in the same wiki so we are in a subwiki and we want a URL which points to the main wiki. // if xwiki.home is set then lets return that. final URL homeParam = getXWikiHomeParameter(context); if (homeParam != null) { return homeParam; } }
URL url = context.getWiki().getServerURL(xwikidb, context); return url == null ? this.serverURL : url; } ----------------------------------------------------------------------
Since wiki.home is not set, the method fails to return an url pointing to the main wiki....
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 ??). _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Thanks Marius for your feedback ! When you say proper wiki descriptor, are you referencing the WikiManager ? Right now under http://myserver.com:8080/WikiManager/WebHome , all i have are my sub wikis, there is no entry for the main wiki. Thanks in advance for your help. -- Chris On 8/2/2013 14:06, Marius Dumitru Florea wrote:
We had the same issue on xwiki.org when we upgraded to 5.1 but in our case removing the xwiki.home setting worked. We reported and fixed http://jira.xwiki.org/browse/XWIKI-9333 . Make sure all your wikis (including the main wiki) have a proper wiki descriptor. If it still doesn't work the maybe you can try Thomas' fix https://github.com/xwiki/xwiki-platform/commit/0a5d76f408b2404444a7241a79f10... (patch xwiki-platform-oldcore then build it and also xwiki-platform-legacy-oldcore, and use the jar of the later in WEB-INF/lib).
Hope this helps, Marius
On Thu, Aug 1, 2013 at 8:54 PM, Christian Meunier <[email protected]> wrote:
Unfortunately, the fix is not as trivial as I originally planned given how XWiki works with the url factory.
I assumed the url in the case of a subwiki ressources would be relative and absolute to the subwiki but it is always normalized after the main wiki so the wiki reference of the document being linked is lost and there is no way right now to fix this by just touching this method I believe, as the context does not have anything useful to figure out correctly what to do...
The solution seems to not set the wiki.home so the urls reflect the domain they are coming from however then the following fails:
XWikiServletURLFactory @ 179: ------------------------------------------------------------ public URL getServerURL(String xwikidb, XWikiContext context) throws MalformedURLException { if (xwikidb == null || xwikidb.equals(context.getOriginalDatabase())) { // This is the case if we are getting a URL for a page which is in // the same wiki as the page which is now being displayed. return this.serverURL; }
if (context.isMainWiki(xwikidb)) { // Not in the same wiki so we are in a subwiki and we want a URL which points to the main wiki. // if xwiki.home is set then lets return that. final URL homeParam = getXWikiHomeParameter(context); if (homeParam != null) { return homeParam; } }
URL url = context.getWiki().getServerURL(xwikidb, context); return url == null ? this.serverURL : url; } ----------------------------------------------------------------------
Since wiki.home is not set, the method fails to return an url pointing to the main wiki....
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 ??). _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Sat, Aug 3, 2013 at 11:37 AM, Christian Meunier <[email protected]> wrote:
Thanks Marius for your feedback !
When you say proper wiki descriptor, are you referencing the WikiManager ? Right now under http://myserver.com:8080/WikiManager/WebHome , all i have are my sub wikis, there is no entry for the main wiki.
Yes, we created a descriptor (WikiManager) for the main wiki, see http://www.xwiki.org/xwiki/bin/view/XWiki/XWikiServerXwiki . Hope this helps, Marius
Thanks in advance for your help.
-- Chris
On 8/2/2013 14:06, Marius Dumitru Florea wrote:
We had the same issue on xwiki.org when we upgraded to 5.1 but in our case removing the xwiki.home setting worked. We reported and fixed http://jira.xwiki.org/browse/XWIKI-9333 . Make sure all your wikis (including the main wiki) have a proper wiki descriptor. If it still doesn't work the maybe you can try Thomas' fix
https://github.com/xwiki/xwiki-platform/commit/0a5d76f408b2404444a7241a79f10... (patch xwiki-platform-oldcore then build it and also xwiki-platform-legacy-oldcore, and use the jar of the later in WEB-INF/lib).
Hope this helps, Marius
On Thu, Aug 1, 2013 at 8:54 PM, Christian Meunier <[email protected]> wrote:
Unfortunately, the fix is not as trivial as I originally planned given how XWiki works with the url factory.
I assumed the url in the case of a subwiki ressources would be relative and absolute to the subwiki but it is always normalized after the main wiki so the wiki reference of the document being linked is lost and there is no way right now to fix this by just touching this method I believe, as the context does not have anything useful to figure out correctly what to do...
The solution seems to not set the wiki.home so the urls reflect the domain they are coming from however then the following fails:
XWikiServletURLFactory @ 179: ------------------------------------------------------------ public URL getServerURL(String xwikidb, XWikiContext context) throws MalformedURLException { if (xwikidb == null || xwikidb.equals(context.getOriginalDatabase())) { // This is the case if we are getting a URL for a page which is in // the same wiki as the page which is now being displayed. return this.serverURL; }
if (context.isMainWiki(xwikidb)) { // Not in the same wiki so we are in a subwiki and we want a URL which points to the main wiki. // if xwiki.home is set then lets return that. final URL homeParam = getXWikiHomeParameter(context); if (homeParam != null) { return homeParam; } }
URL url = context.getWiki().getServerURL(xwikidb, context); return url == null ? this.serverURL : url; } ----------------------------------------------------------------------
Since wiki.home is not set, the method fails to return an url pointing to the main wiki....
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 ??). _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Vincent, did you had a chance to look at this ? Instead of if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) { Should the addition of an empty condition like that sufficient ? : if (type.equals("bin") || this.configuration.getWikiPathPrefix().isEmpty() || type.equals(this.configuration.getWikiPathPrefix())) { Thanks ! -- Chris
2) Empty servlet path support
The second thing I am struggling with is shortening the urls. I am following this guide:
http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs But no matter what I try, I cannot make it work without the '/bin/ prefix. Please note that the xwiki is running under Jetty as the main context (mapped as '/') so the url I have is: server.com/WebHome which according to the short urls document should work.
it appears that the issue comes from StandardXWikiURLFactory: -------------------- String type = extendedURL.getSegments().get(0); if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) { xwikiURL = this.entityURLFactory.createURL(extendedURL, parameters); } else { throw new UnsupportedURLException(String.format("URL type [%s] are not yet supported!", type)); } ----------------
What version of XWiki are you using? I think some changes have been made to the URL "parsing" code in 5.1. Vincent, WDYT? I am using XWiki Enterprise 5.1
Thanks, Marius
Hi Christian, On Jul 29, 2013, at 5:33 PM, Christian Meunier <[email protected]> wrote:
Vincent, did you had a chance to look at this ?
Instead of
if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) {
Should the addition of an empty condition like that sufficient ? :
if (type.equals("bin") || this.configuration.getWikiPathPrefix().isEmpty() || type.equals(this.configuration.getWikiPathPrefix())) {
Sorry, I didn't get the time today but it's high on my todo list! :) I'll try to check this out tomorrow. Continue pinging me till I provide an answer! :) Thanks -Vincent
Thanks !
-- Chris
2) Empty servlet path support
The second thing I am struggling with is shortening the urls. I am following this guide:
http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs But no matter what I try, I cannot make it work without the '/bin/ prefix. Please note that the xwiki is running under Jetty as the main context (mapped as '/') so the url I have is: server.com/WebHome which according to the short urls document should work.
it appears that the issue comes from StandardXWikiURLFactory: -------------------- String type = extendedURL.getSegments().get(0); if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) { xwikiURL = this.entityURLFactory.createURL(extendedURL, parameters); } else { throw new UnsupportedURLException(String.format("URL type [%s] are not yet supported!", type)); } ----------------
What version of XWiki are you using? I think some changes have been made to the URL "parsing" code in 5.1. Vincent, WDYT? I am using XWiki Enterprise 5.1
Thanks, Marius
On 7/29/2013 23:40, Vincent Massol wrote:
Hi Christian,
On Jul 29, 2013, at 5:33 PM, Christian Meunier <[email protected]> wrote:
Vincent, did you had a chance to look at this ?
Instead of
if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) {
Should the addition of an empty condition like that sufficient ? :
if (type.equals("bin") || this.configuration.getWikiPathPrefix().isEmpty() || type.equals(this.configuration.getWikiPathPrefix())) { Sorry, I didn't get the time today but it's high on my todo list! :)
I'll try to check this out tomorrow. Continue pinging me till I provide an answer! :)
Thanks -Vincent
Ping ;)
Hi guys, On Jul 29, 2013, at 11:21 AM, Marius Dumitru Florea <[email protected]> wrote:
On Mon, Jul 29, 2013 at 12:08 PM, Christian Meunier <[email protected]> wrote:
Hi All,
I sent 2 emails to the users list without much success and I am hoping that I might find a more suitable audience for my somewhat technical issues with the devs.
1) Global users in sub wiki.
In the system I am trying to setup, all the users are created using a custom auth module in the main wiki (Global users), so there will be no local users. The issue is that on a sub wiki, when you click on a user to bring up its profile, you end up on a document not found.
From the auth module, the principal returned is prefixed with the 'XWiki.' so the system should be able to differentiate between local and global users and act accordingly.
'XWiki' is the space name, and you have this space both in the local and the global wiki. In order to make sure the user is from the global wiki you need to use the full/absolute user reference: wiki:XWiki.userName. So your auth module should return something like xwiki:XWIki.mflorea, where 'xwiki' is the main wiki, and 'mflorea' is the user alias used to login. On the Java side you should use the DocumentReference and the DocumentReferenceSerializer.
I checked that I could reproduce the issue even if i am not using any custom authentication.
Should i log this as a bug in Jira ?
2) Empty servlet path support
The second thing I am struggling with is shortening the urls. I am following this guide:
But no matter what I try, I cannot make it work without the '/bin/ prefix. Please note that the xwiki is running under Jetty as the main context (mapped as '/') so the url I have is: server.com/WebHome which according to the short urls document should work.
it appears that the issue comes from StandardXWikiURLFactory: -------------------- String type = extendedURL.getSegments().get(0); if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) { xwikiURL = this.entityURLFactory.createURL(extendedURL, parameters); } else { throw new UnsupportedURLException(String.format("URL type [%s] are not yet supported!", type)); } ----------------
What version of XWiki are you using? I think some changes have been made to the URL "parsing" code in 5.1. Vincent, WDYT?
Yes I made a lot of changes to use the new platform-url module. However this module doesn't support short URLs indeed so I broke support for short urls… :( I'll work on fixing it for 5.1.x and 5.2. Sorry about that. -Vincent
Thanks, Marius
So basically for server.com/WebHome, what is happening is that type above equals to "WebHome" and so the condition obviously fails and throws the UnsupportedURLException. Given the above code, I am either forgetting something in the xwiki.cfg or it simply cannot work out of the box...
If i were to provide my own custom XWikiUrlFactory, would it solve entirely the issue or some other parts of the system will nevertheless fails because they have the same assumption regarding the presence of the bin or the PathPrefix in the url ?
Thanks in advance for your help !
-- Chris
On Jul 31, 2013, at 8:03 PM, Vincent Massol <[email protected]> wrote:
Hi guys,
On Jul 29, 2013, at 11:21 AM, Marius Dumitru Florea <[email protected]> wrote:
On Mon, Jul 29, 2013 at 12:08 PM, Christian Meunier <[email protected]> wrote:
Hi All,
I sent 2 emails to the users list without much success and I am hoping that I might find a more suitable audience for my somewhat technical issues with the devs.
1) Global users in sub wiki.
In the system I am trying to setup, all the users are created using a custom auth module in the main wiki (Global users), so there will be no local users. The issue is that on a sub wiki, when you click on a user to bring up its profile, you end up on a document not found.
From the auth module, the principal returned is prefixed with the 'XWiki.' so the system should be able to differentiate between local and global users and act accordingly.
'XWiki' is the space name, and you have this space both in the local and the global wiki. In order to make sure the user is from the global wiki you need to use the full/absolute user reference: wiki:XWiki.userName. So your auth module should return something like xwiki:XWIki.mflorea, where 'xwiki' is the main wiki, and 'mflorea' is the user alias used to login. On the Java side you should use the DocumentReference and the DocumentReferenceSerializer.
I checked that I could reproduce the issue even if i am not using any custom authentication.
Should i log this as a bug in Jira ?
2) Empty servlet path support
The second thing I am struggling with is shortening the urls. I am following this guide:
But no matter what I try, I cannot make it work without the '/bin/ prefix. Please note that the xwiki is running under Jetty as the main context (mapped as '/') so the url I have is: server.com/WebHome which according to the short urls document should work.
it appears that the issue comes from StandardXWikiURLFactory: -------------------- String type = extendedURL.getSegments().get(0); if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) { xwikiURL = this.entityURLFactory.createURL(extendedURL, parameters); } else { throw new UnsupportedURLException(String.format("URL type [%s] are not yet supported!", type)); } ----------------
What version of XWiki are you using? I think some changes have been made to the URL "parsing" code in 5.1. Vincent, WDYT?
Yes I made a lot of changes to use the new platform-url module. However this module doesn't support short URLs indeed so I broke support for short urls… :(
I'll work on fixing it for 5.1.x and 5.2.
I've created http://jira.xwiki.org/browse/XWIKI-9376 Thanks -Vincent
Sorry about that. -Vincent
Thanks, Marius
So basically for server.com/WebHome, what is happening is that type above equals to "WebHome" and so the condition obviously fails and throws the UnsupportedURLException. Given the above code, I am either forgetting something in the xwiki.cfg or it simply cannot work out of the box...
If i were to provide my own custom XWikiUrlFactory, would it solve entirely the issue or some other parts of the system will nevertheless fails because they have the same assumption regarding the presence of the bin or the PathPrefix in the url ?
Thanks in advance for your help !
-- Chris
On Aug 1, 2013, at 10:22 AM, Vincent Massol <[email protected]> wrote: [snip]
2) Empty servlet path support
The second thing I am struggling with is shortening the urls. I am following this guide:
But no matter what I try, I cannot make it work without the '/bin/ prefix. Please note that the xwiki is running under Jetty as the main context (mapped as '/') so the url I have is: server.com/WebHome which according to the short urls document should work.
it appears that the issue comes from StandardXWikiURLFactory: -------------------- String type = extendedURL.getSegments().get(0); if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) { xwikiURL = this.entityURLFactory.createURL(extendedURL, parameters); } else { throw new UnsupportedURLException(String.format("URL type [%s] are not yet supported!", type)); } ----------------
What version of XWiki are you using? I think some changes have been made to the URL "parsing" code in 5.1. Vincent, WDYT?
Yes I made a lot of changes to use the new platform-url module. However this module doesn't support short URLs indeed so I broke support for short urls… :(
I'll work on fixing it for 5.1.x and 5.2.
I've created http://jira.xwiki.org/browse/XWIKI-9376
BTW here's a solution that might work without changing XWiki's configuration at all: * Set up a web server in front of your servlet container (such as Apache) * Configure URL rewriting in order to rewrite URL of type http://<server>/<path1>/<path2> to http://<server>/bin/view/<path1>/<path2> (you'll need to do that only when there are 2 "/" after <server> so that URL like http://<server>/bin/view/... or http://<server>/bin/edit/... don't get rewritten * You'll also need to exclude from rewriting all URLs like http://<server>/resources/... and http://<server>/skins/... It would be nice to have someone write these rules (using apache mod rewrite for ex) so that we can publish them on http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs (maybe someone has published those in our lists already?). Note that if you use jetty you don't need an additional web front end, see http://wiki.eclipse.org/Jetty/Feature/Rewrite_Handler Would also be nice to publish this solution! Yet another solution would be http://tuckey.org/urlrewrite/ (you'd incur the cost of going through a Filter for serving static resources unless you configure your web.xml to prevent that but that cost might be minimal in practice anyway). We should really document all those possibilities on http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs Another question: if you had the following URL scheme available, would you use it? http://dev.xwiki.org/xwiki/bin/view/Design/AlternateURLScheme Thanks -Vincent PS: I'll still work on fixing the issue in the code since it's a regression from before.
Thanks -Vincent
Sorry about that. -Vincent
Thanks, Marius
So basically for server.com/WebHome, what is happening is that type above equals to "WebHome" and so the condition obviously fails and throws the UnsupportedURLException. Given the above code, I am either forgetting something in the xwiki.cfg or it simply cannot work out of the box...
If i were to provide my own custom XWikiUrlFactory, would it solve entirely the issue or some other parts of the system will nevertheless fails because they have the same assumption regarding the presence of the bin or the PathPrefix in the url ?
Thanks in advance for your help !
-- Chris
On Aug 2, 2013, at 1:43 PM, Vincent Massol <[email protected]> wrote:
On Aug 1, 2013, at 10:22 AM, Vincent Massol <[email protected]> wrote:
[snip]
2) Empty servlet path support
The second thing I am struggling with is shortening the urls. I am following this guide:
But no matter what I try, I cannot make it work without the '/bin/ prefix. Please note that the xwiki is running under Jetty as the main context (mapped as '/') so the url I have is: server.com/WebHome which according to the short urls document should work.
it appears that the issue comes from StandardXWikiURLFactory: -------------------- String type = extendedURL.getSegments().get(0); if (type.equals("bin") || type.equals(this.configuration.getWikiPathPrefix())) { xwikiURL = this.entityURLFactory.createURL(extendedURL, parameters); } else { throw new UnsupportedURLException(String.format("URL type [%s] are not yet supported!", type)); } ----------------
What version of XWiki are you using? I think some changes have been made to the URL "parsing" code in 5.1. Vincent, WDYT?
Yes I made a lot of changes to use the new platform-url module. However this module doesn't support short URLs indeed so I broke support for short urls… :(
I'll work on fixing it for 5.1.x and 5.2.
I've created http://jira.xwiki.org/browse/XWIKI-9376
BTW here's a solution that might work without changing XWiki's configuration at all: * Set up a web server in front of your servlet container (such as Apache) * Configure URL rewriting in order to rewrite URL of type http://<server>/<path1>/<path2> to http://<server>/bin/view/<path1>/<path2> (you'll need to do that only when there are 2 "/" after <server> so that URL like http://<server>/bin/view/... or http://<server>/bin/edit/... don't get rewritten * You'll also need to exclude from rewriting all URLs like http://<server>/resources/... and http://<server>/skins/...
It would be nice to have someone write these rules (using apache mod rewrite for ex) so that we can publish them on http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs (maybe someone has published those in our lists already?).
Note that if you use jetty you don't need an additional web front end, see http://wiki.eclipse.org/Jetty/Feature/Rewrite_Handler Would also be nice to publish this solution!
Yet another solution would be http://tuckey.org/urlrewrite/ (you'd incur the cost of going through a Filter for serving static resources unless you configure your web.xml to prevent that but that cost might be minimal in practice anyway).
We should really document all those possibilities on http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs
Another question: if you had the following URL scheme available, would you use it? http://dev.xwiki.org/xwiki/bin/view/Design/AlternateURLScheme
Thanks -Vincent
PS: I'll still work on fixing the issue in the code since it's a regression from before.
Fixed. Thanks -Vincent
Thanks -Vincent
Sorry about that. -Vincent
Thanks, Marius
So basically for server.com/WebHome, what is happening is that type above equals to "WebHome" and so the condition obviously fails and throws the UnsupportedURLException. Given the above code, I am either forgetting something in the xwiki.cfg or it simply cannot work out of the box...
If i were to provide my own custom XWikiUrlFactory, would it solve entirely the issue or some other parts of the system will nevertheless fails because they have the same assumption regarding the presence of the bin or the PathPrefix in the url ?
Thanks in advance for your help !
-- Chris
Hi Vincent,
Thanks for the fix, there is however still one little issue related to
this servletPath thing.
Rigth now, I am using urlrewrite to shorten the servlet path (thanks for
the urlrewrite.xml btw !) which is imho the best route to deliver out of
the box a short url solution. I use it everywhere on a pretty high
traffic website, the impact is absolutely minimal... Speaking of which,
you might want to include
http://sourceforge.net/projects/pjl-comp-filter/ in the 5.2 in order to
provide compression out of the box as well.
Back to the issue ;)
Right now, accessing a short url works but all the generated urls will
have the /bin so it kinda defeat the purpose.
The Culprit is in the logic of XWiki.getServletPatch()
Basically even if the xwiki.defaultservletpath is set to an empty
string, it is not used because right now it will default the bin/ if the
current servlet path is already /bin which is of course always true
since we forward it there...
For now, I have fixed is like that:
if (context.getRequest() != null) {
if (StringUtils.isEmpty(servletPath)) {
/*String currentServletpath =
context.getRequest().getServletPath();
if (currentServletpath != null &&
currentServletpath.startsWith("/bin")) {
servletPath = "bin/";
} else {
servletPath = Param("xwiki.defaultservletpath",
"bin/");
}*/
servletPath = Param("xwiki.defaultservletpath", "bin/");
}
}
Side quesition, how do you inject the getNotificationManager in XWiki
class ? Since i have recompiled the class, the log is throwing exception
that the LegacyNotificationDispatcher could not lookup the
NotificationManager using XWiki.getNotificationManager() but there is no
such method... I looked at the pom and didnt see any aspectJ or class
manipulation that would explain how this is done.
Also since the LegacyNotificationDispatcher is deprecated and all its
events are deprecated as well, is it normal that this component still
get notified ?
Thanks !
On 8/2/2013 22:49, Vincent Massol wrote:
> On Aug 2, 2013, at 1:43 PM, Vincent Massol <[email protected]> wrote:
>
>> On Aug 1, 2013, at 10:22 AM, Vincent Massol <[email protected]> wrote:
>>
>> [snip]
>>
>>>>>> 2) Empty servlet path support
>>>>>>
>>>>>> The second thing I am struggling with is shortening the urls. I am following
>>>>>> this guide:
>>>>>>> http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs
>>>>>> But no matter what I try, I cannot make it work without the '/bin/ prefix.
>>>>>> Please note that the xwiki is running under Jetty as the main context
>>>>>> (mapped as '/') so the url I have is:
>>>>>> server.com/WebHome which according to the short urls document should work.
>>>>>>
>>>>>> it appears that the issue comes from StandardXWikiURLFactory:
>>>>>> --------------------
>>>>>> String type = extendedURL.getSegments().get(0);
>>>>>> if (type.equals("bin") ||
>>>>>> type.equals(this.configuration.getWikiPathPrefix())) {
>>>>>> xwikiURL = this.entityURLFactory.createURL(extendedURL,
>>>>>> parameters);
>>>>>> } else {
>>>>>> throw new UnsupportedURLException(String.format("URL type [%s]
>>>>>> are not yet supported!", type));
>>>>>> }
>>>>>> ----------------
>>>>>>
>>>>> What version of XWiki are you using? I think some changes have been
>>>>> made to the URL "parsing" code in 5.1. Vincent, WDYT?
>>>> Yes I made a lot of changes to use the new platform-url module. However this module doesn't support short URLs indeed so I broke support for short urls… :(
>>>>
>>>> I'll work on fixing it for 5.1.x and 5.2.
>>> I've created http://jira.xwiki.org/browse/XWIKI-9376
>> BTW here's a solution that might work without changing XWiki's configuration at all:
>> * Set up a web server in front of your servlet container (such as Apache)
>> * Configure URL rewriting in order to rewrite URL of type http://<server>/<path1>/<path2> to http://<server>/bin/view/<path1>/<path2> (you'll need to do that only when there are 2 "/" after <server> so that URL like http://<server>/bin/view/... or http://<server>/bin/edit/... don't get rewritten
>> * You'll also need to exclude from rewriting all URLs like http://<server>/resources/... and http://<server>/skins/...
>>
>> It would be nice to have someone write these rules (using apache mod rewrite for ex) so that we can publish them on http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs (maybe someone has published those in our lists already?).
>>
>> Note that if you use jetty you don't need an additional web front end, see http://wiki.eclipse.org/Jetty/Feature/Rewrite_Handler
>> Would also be nice to publish this solution!
>>
>> Yet another solution would be http://tuckey.org/urlrewrite/ (you'd incur the cost of going through a Filter for serving static resources unless you configure your web.xml to prevent that but that cost might be minimal in practice anyway).
>>
>> We should really document all those possibilities on http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs
>>
>> Another question: if you had the following URL scheme available, would you use it?
>> http://dev.xwiki.org/xwiki/bin/view/Design/AlternateURLScheme
>>
>> Thanks
>> -Vincent
>>
>> PS: I'll still work on fixing the issue in the code since it's a regression from before.
> Fixed.
>
> Thanks
> -Vincent
>
>>> Thanks
>>> -Vincent
>>>
>>>> Sorry about that.
>>>> -Vincent
>>>>
>>>>> Thanks,
>>>>> Marius
>>>>>
>>>>>> So basically for server.com/WebHome, what is happening is that type above
>>>>>> equals to "WebHome" and so the condition obviously fails and throws the
>>>>>> UnsupportedURLException.
>>>>>> Given the above code, I am either forgetting something in the xwiki.cfg or
>>>>>> it simply cannot work out of the box...
>>>>>>
>>>>>> If i were to provide my own custom XWikiUrlFactory, would it solve entirely
>>>>>> the issue or some other parts of the system will nevertheless fails because
>>>>>> they have the same assumption regarding the presence of the bin or the
>>>>>> PathPrefix in the url ?
>>>>>>
>>>>>> Thanks in advance for your help !
>>>>>>
>>>>>> --
>>>>>> Chris
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
On Sat, Aug 3, 2013 at 11:02 AM, Christian Meunier <[email protected]> wrote:
Hi Vincent,
Thanks for the fix, there is however still one little issue related to this servletPath thing.
Rigth now, I am using urlrewrite to shorten the servlet path (thanks for the urlrewrite.xml btw !) which is imho the best route to deliver out of the box a short url solution. I use it everywhere on a pretty high traffic website, the impact is absolutely minimal... Speaking of which, you might want to include http://sourceforge.net/projects/pjl-comp-filter/ in the 5.2 in order to provide compression out of the box as well.
Back to the issue ;)
Right now, accessing a short url works but all the generated urls will have the /bin so it kinda defeat the purpose. The Culprit is in the logic of XWiki.getServletPatch()
Basically even if the xwiki.defaultservletpath is set to an empty string, it is not used because right now it will default the bin/ if the current servlet path is already /bin which is of course always true since we forward it there...
For now, I have fixed is like that:
if (context.getRequest() != null) { if (StringUtils.isEmpty(servletPath)) { /*String currentServletpath = context.getRequest().getServletPath(); if (currentServletpath != null && currentServletpath.startsWith("/bin")) { servletPath = "bin/"; } else { servletPath = Param("xwiki.defaultservletpath", "bin/"); }*/
servletPath = Param("xwiki.defaultservletpath", "bin/"); } }
Side quesition, how do you inject the getNotificationManager in XWiki class ? Since i have recompiled the class, the log is throwing exception that the LegacyNotificationDispatcher could not lookup the NotificationManager using XWiki.getNotificationManager() but there is no such method... I looked at the pom and didnt see any aspectJ or class manipulation that would explain how this is done.
Also since the LegacyNotificationDispatcher is deprecated and all its events are deprecated as well, is it normal that this component still get notified ?
You built xwiki-platform-oldcore and then xwiki-platform-legacy-oldcore and you copied the legacy jar to WEB-INF/lib right? Make sure you don't have both the oldcore and the legacy-oldcore jars in WEB-INF/lib. Hope this helps, Marius
Thanks !
On 8/2/2013 22:49, Vincent Massol wrote:
On Aug 2, 2013, at 1:43 PM, Vincent Massol <[email protected]> wrote:
On Aug 1, 2013, at 10:22 AM, Vincent Massol <[email protected]> wrote:
[snip]
> 2) Empty servlet path support > > The second thing I am struggling with is shortening the urls. I am > following > this guide: >> >> http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs > > But no matter what I try, I cannot make it work without the '/bin/ > prefix. > Please note that the xwiki is running under Jetty as the main context > (mapped as '/') so the url I have is: > server.com/WebHome which according to the short urls document should > work. > > it appears that the issue comes from StandardXWikiURLFactory: > -------------------- > String type = extendedURL.getSegments().get(0); > if (type.equals("bin") || > type.equals(this.configuration.getWikiPathPrefix())) { > xwikiURL = this.entityURLFactory.createURL(extendedURL, > parameters); > } else { > throw new UnsupportedURLException(String.format("URL type > [%s] > are not yet supported!", type)); > } > ---------------- > What version of XWiki are you using? I think some changes have been made to the URL "parsing" code in 5.1. Vincent, WDYT?
Yes I made a lot of changes to use the new platform-url module. However this module doesn't support short URLs indeed so I broke support for short urls… :(
I'll work on fixing it for 5.1.x and 5.2.
I've created http://jira.xwiki.org/browse/XWIKI-9376
BTW here's a solution that might work without changing XWiki's configuration at all: * Set up a web server in front of your servlet container (such as Apache) * Configure URL rewriting in order to rewrite URL of type http://<server>/<path1>/<path2> to http://<server>/bin/view/<path1>/<path2> (you'll need to do that only when there are 2 "/" after <server> so that URL like http://<server>/bin/view/... or http://<server>/bin/edit/... don't get rewritten * You'll also need to exclude from rewriting all URLs like http://<server>/resources/... and http://<server>/skins/...
It would be nice to have someone write these rules (using apache mod rewrite for ex) so that we can publish them on http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs (maybe someone has published those in our lists already?).
Note that if you use jetty you don't need an additional web front end, see http://wiki.eclipse.org/Jetty/Feature/Rewrite_Handler Would also be nice to publish this solution!
Yet another solution would be http://tuckey.org/urlrewrite/ (you'd incur the cost of going through a Filter for serving static resources unless you configure your web.xml to prevent that but that cost might be minimal in practice anyway).
We should really document all those possibilities on http://platform.xwiki.org/xwiki/bin/view/Main/ShortURLs
Another question: if you had the following URL scheme available, would you use it? http://dev.xwiki.org/xwiki/bin/view/Design/AlternateURLScheme
Thanks -Vincent
PS: I'll still work on fixing the issue in the code since it's a regression from before.
Fixed.
Thanks -Vincent
Thanks -Vincent
Sorry about that. -Vincent
Thanks, Marius
> So basically for server.com/WebHome, what is happening is that type > above > equals to "WebHome" and so the condition obviously fails and throws > the > UnsupportedURLException. > Given the above code, I am either forgetting something in the > xwiki.cfg or > it simply cannot work out of the box... > > If i were to provide my own custom XWikiUrlFactory, would it solve > entirely > the issue or some other parts of the system will nevertheless fails > because > they have the same assumption regarding the presence of the bin or > the > PathPrefix in the url ? > > Thanks in advance for your help ! > > -- > Chris
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (3)
-
Christian Meunier -
Marius Dumitru Florea -
Vincent Massol