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
<vincent(a)massol.net> wrote:
On Aug 1, 2013, at 10:22 AM, Vincent Massol
<vincent(a)massol.net> 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
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs