On Tue, Mar 20, 2012 at 9:11 AM, Paul Libbrecht <[email protected]> wrote:
> Thomas,
>
> this is a picky topic.
>
> First you have to differentiate host-relative-URLs (those that start with /), 
> relative URLs (relative to the current path, e.g. ../Main/WebHome) and 
> absolute URLs. I would vote +1 if you said you want to use host-relative URLs.

Actually XWiki only have API for host-relative-URLs and external URL
so I'm talking about host-relative-URLs here. I don't know any place
where we produce URL relative to the current path.

>
> Second, a major reason to use absolute URLs is when something back down does 
> it wrong.
> E.g. some Apache mod_proxy or servlet-container configs can make it wrong. So 
> there are sometimes when this is useful, as a rescue, but not as a 
> bad-practice, it should always be possible in case.

Most URL generated from redirect are done trough
com.xpn.xwiki.web.Utils#getRedirect and that's were I was planning to
modify the call to the actual getURL (and make code that does not use
getRedirect to use it as much as possible). If we really want to we
can easily make configurable the fact to produce absolute URL for
redirect instead of relative URL.

>
> paul
>
>
>
> Le 20 mars 2012 à 08:39, Thomas Mortagne a écrit :
>
>> Hi devs,
>>
>> In HTTP specifications a redirect is always absolute URL which is
>> probably why we use absolute URL with sendRedirect.
>>
>> However sendRedirect does not produce direct HTTP response but allows
>> relative URL and delegate to the application server the job of
>> producing proper absolute URL.
>>
>> IMO XWiki should always use relative URL everywhere it can so I
>> propose to change our practice to use relative URL instead of absolute
>> URL with HttpSevletResponse#sendRedirect when possible.
>>
>> The only reasons I see to use external URLs are:
>> * interwiki URL in a  domain based multiwiki
>> * html/pdf export for links pointing on not exported pages or non view 
>> actions
>>
>> WDYT ?
>>
>> Here is my +1. We very often fix bugs in the way to produce external
>> URL and it's still not OK (see
>> http://jira.xwiki.org/browse/XWIKI-7632) so lets reduce the scope for
>> this need as much as possible.
>>
>> --
>> Thomas Mortagne
>> _______________________________________________
>> devs mailing list
>> [email protected]
>> http://lists.xwiki.org/mailman/listinfo/devs
>
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs



-- 
Thomas Mortagne
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to