java.lang.Object
com.djrapitops.plan.delivery.web.resolver.request.URIPath

public final class URIPath extends Object
  • Constructor Details

    • URIPath

      public URIPath(String path)
  • Method Details

    • asString

      public String asString()
      Obtain the full path.
      Returns:
      Example: "/target/path/in/url"
    • getPart

      public Optional<String> getPart(int index)
      Obtain part of the path by index of slashes in the URL.

      Example: "/example/path", 0 returns "example" Example: "/example/path", 1 returns "path" Example: "/example/path", 2 returns empty optional Example: "/example/path/", 2 returns "" Example: "/", 0 returns "" Example: "/", 1 returns empty optional

      Parameters:
      index - Index from root, eg. /0/1/2/3 etc
      Returns:
      part after a '/' in the path,
    • endsWith

      public boolean endsWith(String suffix)
    • omitFirst

      public URIPath omitFirst()
      Immutable modification, removes first part of the path string.

      Example: URIPath "/example/path" return value of omitFirst URIPath is "/path" Example: URIPath "/example" return value of omitFirst URIPath is "/" Example: URIPath "/" return value of omitFirst URIPath is ""

      Returns:
      new URIPath with first part removed.
    • length

      public int length()
    • toString

      public String toString()
      Overrides:
      toString in class Object