Package org.xwiki.url

Offers APIs to convert URLs into Resource Reference objects and vice-versa.

All XWiki modules should use this API when they need to manipulate URLs and should not manipulate the JDK's URL class. The reasons are:

  • reduce bugs: this module is well-tested, handles escaping and encoding properly, and more. It's likely that manipulating URLs by yourself would lead to bugs, especially since there are limitations with the JDK's URL implementation.
  • allows plugging different XWiki URL schemes without having to change any other part of the code.

The only places where it's allowed to see the JDK's URL class is in system boundary code, in code accepting an external URL and transforming it into a XWiki Resource Reference and in code generating a URL from a XWiki Resource Reference for outside processes.