Path

zio.http.Path
See thePath companion object
final case class Path

Path is an immutable representation of the path of a URL. Internally it stores each element of a path in a sequence of text, together with flags on whether there are leading and trailing slashes in the path. This allows for a combination of precision and performance and supports a rich API.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Self type

Members list

Value members

Concrete methods

def ++(that: Path): Path

Combines two paths together to create a new one, having a leading slash if only the left path has a leading slash, and a trailing slash if only the right path has a trailing slash. Note that if you concat the empty path to any other path, either on the left or right hand side, you get back that same path unmodified.

Combines two paths together to create a new one, having a leading slash if only the left path has a leading slash, and a trailing slash if only the right path has a trailing slash. Note that if you concat the empty path to any other path, either on the left or right hand side, you get back that same path unmodified.

Attributes

def /(name: String): Path

Appends a segment at the end of the path.

Appends a segment at the end of the path.

If there is already a trailing slash when you append a segment, then the trailing slash will be removed (more precisely, it becomes the slash that separates the existing path from the new segment).

Attributes

def /:(name: String): Path

Prepends the path with the provided segment.

Prepends the path with the provided segment.

If there is already a leading slash when you prepend a segment, then the leading slash will be removed (more precisely, it becomes the slash that separates the new segment from the existing path).

Attributes

Prepends a leading slash to the path.

Prepends a leading slash to the path.

Attributes

Appends a trailing slash to the path.

Appends a trailing slash to the path.

Attributes

def concat(other: Path): Path

Named alias to ++ operator.

Named alias to ++ operator.

Attributes

def drop(n: Int): Path

Drops the first n segments from the path, treating both leading and trailing slashes as segments.

Drops the first n segments from the path, treating both leading and trailing slashes as segments.

Attributes

Drops the leading slash if available.

Drops the leading slash if available.

Attributes

def dropRight(n: Int): Path

Drops the last n segments from the path, treating both leading and trailing slashes as segments.

Drops the last n segments from the path, treating both leading and trailing slashes as segments.

Attributes

Drops the trailing slash if available.

Drops the trailing slash if available.

Attributes

def encode: String

Encodes the current path into a valid string.

Encodes the current path into a valid string.

Attributes

override def equals(that: Any): Boolean

Compares the receiver object (this) with the argument object (that) for equivalence.

Compares the receiver object (this) with the argument object (that) for equivalence.

Any implementation of this method should be an equivalence relation:

  • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
  • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any instances x, y, and z of type Any if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode to ensure that objects which are "equal" (o1.equals(o2) returns true) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)).

Value parameters

that

the object to compare against this object for equality.

Attributes

Returns

true if the receiver object is equivalent to the argument; false otherwise.

Definition Classes
Equals -> Any
def hasLeadingSlash: Boolean

Checks if the path contains a leading slash.

Checks if the path contains a leading slash.

Attributes

def hasTrailingSlash: Boolean

Checks if the path contains a trailing slash.

Checks if the path contains a trailing slash.

Attributes

override def hashCode: Int

Calculate a hash code value for the object.

Calculate a hash code value for the object.

The default hashing algorithm is platform dependent.

Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

Attributes

Returns

the hash code value for this object.

Definition Classes
Any
def isEmpty: Boolean

Checks if the path is equal to "".

Checks if the path is equal to "".

Attributes

def isRoot: Boolean

Checks if the path is equal to "/".

Checks if the path is equal to "/".

Attributes

def nonEmpty: Boolean

Checks if the path is not equal to "".

Checks if the path is not equal to "".

Attributes

Normalizes the path for proper equals/hashCode treatment.

Normalizes the path for proper equals/hashCode treatment.

Attributes

RFC 3986 § 5.2.4 Remove Dot Segments

RFC 3986 § 5.2.4 Remove Dot Segments

Attributes

Returns

the Path with . and .. resolved and removed

def reverse: Path

Creates a new path from this one with it's segments reversed.

Creates a new path from this one with it's segments reversed.

Attributes

def size: Int

Returns the "size" of a path, which counts leading and trailing slash, if present.

Returns the "size" of a path, which counts leading and trailing slash, if present.

Attributes

def startsWith(other: Path): Boolean

Checks if the path starts with the provided path

Checks if the path starts with the provided path

Attributes

def take(n: Int): Path

Returns a new path containing the first n segments of the path, treating both leading and trailing slashes as segments.

Returns a new path containing the first n segments of the path, treating both leading and trailing slashes as segments.

Attributes

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
def unnest(prefix: Path): Path

Unnests a path that has been nested at the specified prefix. If the path is not nested at the specified prefix, the same path is returned.

Unnests a path that has been nested at the specified prefix. If the path is not nested at the specified prefix, the same path is returned.

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Concrete fields

lazy val unapply: Option[(String, Path)]
lazy val unapplyRight: Option[(Path, String)]