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