Class URITool.URLRebaser

  • Enclosing class:
    URITool

    public static class URITool.URLRebaser
    extends Object
    URL rebaser: based on an old and a new path, can rebase a link based on old path to a value based on the new path.
    • Constructor Detail

      • URLRebaser

        protected URLRebaser​(@Nullable
                             String oldPath,
                             @Nullable
                             String newPath)
        Construct a URL rebaser.
        Parameters:
        oldPath - the old path. The base URI. Has to be a valid absolute URI. In addition, the path of the URI should not have any file part, ie http://maven.apache.org/ is valid, http://maven.apache.org/index.html is not.
        newPath - the new base URI. Has to be parsable as a URI.
    • Method Detail

      • getNewPath

        @Nullable
        public String getNewPath()
        Get the new path.
        Returns:
        the new path.
      • getOldPath

        @Nullable
        public String getOldPath()
        Get the old path.
        Returns:
        the old path.
      • rebaseLink

        public String rebaseLink​(@Nullable
                                 String link)
        Rebase only affects relative links, a relative link wrt an old base gets translated, so it points to the same location as viewed from a new base.
        Parameters:
        link - link to rebase
        Returns:
        Returns a String representing link rebased.