On 03/20/2012 03:39 AM, Thomas Mortagne wrote:
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 ?
I don't think this will actually solve the problem. As long as XWiki
doesn't know the correct URL to use, I doubt that the container will do
any better. I just tested this on Apache HTTPD + mod_proxy_http going to
Jetty, and it didn't solve the problem.
For the PDF export, all URLs must be external. A relative URL in a PDF
doesn't have a base URL to work with, since the PDF is a standalone
document. That's why we use a special URLFactory when exporting PDFs.
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.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/