Class UrlRelativePathResolver


  • public final class UrlRelativePathResolver
    extends java.lang.Object
    Convert a path of the form `/a/b/c/../../d/../e/../..` etc to a resolved path.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String resolve​(java.lang.String base, java.lang.String redirect)
      Convert a path of the form `/a/b/c/../../d/../e/../..` etc to a resolved path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UrlRelativePathResolver

        public UrlRelativePathResolver()
    • Method Detail

      • resolve

        public static java.lang.String resolve​(java.lang.String base,
                                               java.lang.String redirect)
                                        throws RelativePathException
        Convert a path of the form `/a/b/c/../../d/../e/../..` etc to a resolved path.
        Parameters:
        base - the base path that we're moving relative to
        redirect - the relative path - can include `../` sections
        Returns:
        the resolved path
        Throws:
        RelativePathException - when the redirect is beyond the root of the base path