Package ai.vespa.http

Class HttpURL.Path

java.lang.Object
ai.vespa.http.HttpURL.Path
Enclosing class:
HttpURL

public static class HttpURL.Path extends Object
  • Method Details

    • empty

      public static HttpURL.Path empty()
      Creates a new, empty path, with a trailing slash, using HttpURL.requirePathSegment(java.lang.String) for segment validation.
    • empty

      public static HttpURL.Path empty(Consumer<String> validator)
      Creates a new, empty path, with a trailing slash, using the indicated validator for segments.
    • parse

      public static HttpURL.Path parse(String raw)
      Parses the given raw, normalized path string; this ignores whether the path is absolute or relative.
    • parse

      public static HttpURL.Path parse(String raw, Consumer<String> validator)
      Parses the given raw, normalized path string; this ignores whether the path is absolute or relative.)
    • head

      public HttpURL.Path head(int count)
      Returns a copy of this where only the first segments are retained, and with a trailing slash.
    • tail

      public HttpURL.Path tail(int count)
      Returns a copy of this where only the last segments are retained.
    • skip

      public HttpURL.Path skip(int count)
      Returns a copy of this where the first segments are skipped.
    • cut

      public HttpURL.Path cut(int count)
      Returns a copy of this where the last segments are cut off, and with a trailing slash.
    • append

      public HttpURL.Path append(String segment)
      Returns a copy of this with the decoded segment appended at the end; it may not be either of "", "." or "..".
    • append

      public HttpURL.Path append(HttpURL.Path other)
      Returns a copy of this all segments of the other path appended, with a trailing slash as per the appendage.
    • append

      public HttpURL.Path append(List<String> segments)
      Returns a copy of this all given segments appended, with a trailing slash as per this path.
    • hasTrailingSlash

      public boolean hasTrailingSlash()
      Whether this path has a trailing slash.
    • withTrailingSlash

      public HttpURL.Path withTrailingSlash()
      Returns a copy of this which encodes a trailing slash.
    • withoutTrailingSlash

      public HttpURL.Path withoutTrailingSlash()
      Returns a copy of this which does not encode a trailing slash.
    • segments

      public List<String> segments()
      A mutable copy of the URL decoded segments that make up this path; never null, "", "." or "..".
    • length

      public int length()
      The number of segments in this path.
    • toString

      public String toString()
      Intentionally not usable for constructing new URIs. Use HttpURL for that instead.
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object