Class UrlRelativePathResolver

java.lang.Object
uk.num.numlib.internal.util.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.
  • Constructor Summary

    Constructors 
    Constructor Description
    UrlRelativePathResolver()  
  • Method Summary

    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 Details

  • Method Details

    • 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