case class Uri(scheme: Option[String], authority: Option[Authority], pathSegments: PathSegments, querySegments: Seq[QuerySegment], fragmentSegment: Option[Segment]) extends Product with Serializable
A URI. Can represent both relative and absolute URIs, hence in terms of https://tools.ietf.org/html/rfc3986, this is a URI reference.
All components (scheme, host, query, ...) are stored decoded, and become encoded upon serialization (using toString).
Instances can be created using the uri interpolator: uri"..."
(see UriInterpolator), or the factory methods on
the Uri companion object.
The apply
/safeApply
/unsafeApply
methods create absolute URIs and require a host. The relative
methods
creates a relative URI, given path/query/fragment components.
- querySegments
Either key-value pairs, single values, or plain query segments. Key value pairs will be serialized as
k=v
, and blocks of key-value pairs/single values will be combined using&
. Note that no&
or other separators are added around plain query segments - if required, they need to be added manually as part of the plain query segment. Custom encoding logic can be provided when creating a segment.
- Alphabetic
- By Inheritance
- Uri
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new Uri(scheme: Option[String], authority: Option[Authority], pathSegments: PathSegments, querySegments: Seq[QuerySegment], fragmentSegment: Option[Segment])
- querySegments
Either key-value pairs, single values, or plain query segments. Key value pairs will be serialized as
k=v
, and blocks of key-value pairs/single values will be combined using&
. Note that no&
or other separators are added around plain query segments - if required, they need to be added manually as part of the plain query segment. Custom encoding logic can be provided when creating a segment.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addParam(k: String, v: Option[String]): Uri
- def addParam(k: String, v: String): Uri
- def addParams(ps: (String, String)*): Uri
- def addParams(mqp: QueryParams): Uri
- def addParams(ps: Map[String, String]): Uri
- def addPath(ps: Seq[String]): Uri
- def addPath(p: String, ps: String*): Uri
- def addPathSegment(s: Segment): Uri
- def addPathSegments(ss: Seq[Segment]): Uri
- def addPathSegments(s1: Segment, s2: Segment, ss: Segment*): Uri
- def addQuerySegment(qs: QuerySegment): Uri
- def addQuerySegments(qss: Seq[QuerySegment]): Uri
- def addQuerySegments(qs1: QuerySegment, qs2: QuerySegment, qss: QuerySegment*): Uri
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def authority(a: Some[Authority]): Uri
Replace the authority.
- def authority(a: Authority): Uri
Replace the authority.
- val authority: Option[Authority]
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def fragment: Option[String]
- def fragment(f: Option[String]): Uri
Replace the fragment.
- def fragment(f: String): Uri
Replace the fragment.
- def fragmentSegment(s: Option[Segment]): Uri
Replace the fragment.
- val fragmentSegment: Option[Segment]
- def fragmentSegmentEncoding(encoding: Encoding): Uri
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def host: Option[String]
- def host(h: String): Uri
Replace the host.
Replace the host. Does not validate the new host value if it's nonempty.
- def hostSegment(s: Option[Segment]): Uri
Replace the host.
Replace the host. Does not validate the new host value if it's nonempty.
- def hostSegment(s: Segment): Uri
Replace the host.
Replace the host. Does not validate the new host value if it's nonempty.
- def hostSegmentEncoding(encoding: Encoding): Uri
- def isAbsolute: Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isRelative: Boolean
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def params: QueryParams
- def paramsMap: Map[String, String]
- def paramsSeq: Seq[(String, String)]
- def path: Seq[String]
- val pathSegments: PathSegments
- def pathSegmentsEncoding(encoding: Encoding): Uri
- def port: Option[Int]
- def port(p: Option[Int]): Uri
Replace the port.
Replace the port. Adds an empty host if one is absent, and port is defined.
- def port(p: Int): Uri
Replace the port.
Replace the port. Adds an empty host if one is absent.
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- val querySegments: Seq[QuerySegment]
- def querySegmentsEncoding(encoding: Encoding): Uri
Replace encoding for query segments: applies to key-value, only-value and plain ones.
- def queryValueSegmentsEncoding(valueEncoding: Encoding): Uri
Replace encoding for the value part of key-value query segments and for only-value ones.
- def resolve(other: Uri): Uri
- def scheme(s: Option[String]): Uri
Replace the scheme.
Replace the scheme. Does not validate the new scheme value.
- def scheme(s: String): Uri
Replace the scheme.
Replace the scheme. Does not validate the new scheme value.
- val scheme: Option[String]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toJavaUri: URI
- def toString(): String
- Definition Classes
- Uri → AnyRef → Any
- def userInfo: Option[UserInfo]
- def userInfo(ui: Option[UserInfo]): Uri
Replace the user info with username/password combination.
Replace the user info with username/password combination. Adds an empty host if one is absent, and user info is defined.
- def userInfo(username: String, password: String): Uri
Replace the user info with username/password combination.
Replace the user info with username/password combination. Adds an empty host if one is absent.
- def userInfo(username: String): Uri
Replace the user info with a username only.
Replace the user info with a username only. Adds an empty host if one is absent.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def withParam(k: String, v: Option[String]): Uri
Replace query with the given single optional parameter.
- def withParam(k: String, v: String): Uri
Replace query with the given single parameter.
- def withParams(ps: (String, String)*): Uri
Replace query with the given parameters.
- def withParams(mqp: QueryParams): Uri
Replace query with the given parameters.
- def withParams(ps: Map[String, String]): Uri
Replace query with the given parameters.
- def withPath(ps: Seq[String]): Uri
- def withPath(p: String, ps: String*): Uri
- def withPathSegment(s: Segment): Uri
- def withPathSegments(ss: Seq[Segment]): Uri
- def withPathSegments(s1: Segment, s2: Segment, ss: Segment*): Uri
- def withWholePath(p: String): Uri
Replace the whole path with the given one.
Replace the whole path with the given one. Leading
/
will be removed, if present, and the path will be split into segments on/
.
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)
- def param(k: String, v: Option[String]): Uri
Adds the given parameter with an optional value to the query if it is present.
Adds the given parameter with an optional value to the query if it is present.
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Use addParam or withParam
- def param(k: String, v: String): Uri
Adds the given parameter to the query.
Adds the given parameter to the query.
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Use addParam or withParam
- def params(ps: (String, String)*): Uri
Adds the given parameters to the query.
Adds the given parameters to the query.
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Use addParam or withParam
- def params(mqp: QueryParams): Uri
Adds the given parameters to the query.
Adds the given parameters to the query.
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Use addParam or withParam
- def params(ps: Map[String, String]): Uri
Adds the given parameters to the query.
Adds the given parameters to the query.
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Use addParam or withParam
- def path(ps: Seq[String]): Uri
Replace path with the given path segments.
Replace path with the given path segments.
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Use addPath, withPath or withWholePath
- def path(p1: String, p2: String, ps: String*): Uri
Replace path with the given path segments.
Replace path with the given path segments.
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Use addPath, withPath or withWholePath
- def path(p: String): Uri
Replace path with the given single-segment path.
Replace path with the given single-segment path.
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Use addPath, withPath or withWholePath
- def pathSegment(s: Segment): Uri
Replace path with the given path segment.
Replace path with the given path segment.
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Use addPath, withPath or withWholePath
- def pathSegments(ss: Seq[Segment]): Uri
Replace path with the given path segments.
Replace path with the given path segments.
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Use addPath, withPath or withWholePath
- def pathSegments(s1: Segment, s2: Segment, ss: Segment*): Uri
Replace path with the given path segment.
Replace path with the given path segment.
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Use addPath, withPath or withWholePath
- def querySegment(qs: QuerySegment): Uri
Adds the given query segment.
Adds the given query segment.
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0) Use addQuerySegment