Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-437

Improve URL factories and create a xwiki-url module for manipulating XWiki URLs

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Duplicate
    • Major
    • None
    • 1.0 B1
    • None

    Description

      Right now there are URL factories in XWiki the problem is that they return URL objects which means that all parts of the code which need to manipulate the URL (like extract some portion of it) have to parse it. This is fastidious, prone to error and duplicates efforts.

      Here's an example of what the ZipURLExplorer plugin does simply to get the URL portion after the document's name:

          protected String getFileLocationFromZipURL(String url, String action)
          {
              String path = url.substring(url.indexOf("/" + action));
              int pos = 0;
              for (int i = 0; i < 4; i++) {
                  pos = path.indexOf("/", pos + 1);
              }
              if (pos == -1) {
                  return "";
              }
              return path.substring(pos + 1);
          }
      

      This type of code can be found again in other places.

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: