sealed abstract case class Uri extends Product with Serializable
An immutable model of an internet URI as defined by https://tools.ietf.org/html/rfc3986. All members of this class represent the *decoded* URI elements (i.e. without percent-encoding), with the exception of 'rawQueryString': rawQueryString should be a string that only contains characters permitted by https://tools.ietf.org/html/rfc3986#section-3.4, any other characters must be percent-encoded (for example through UriParser.parseRawQueryString)
- Annotations
- @DoNotInherit()
- Source
- Uri.scala
- Alphabetic
- By Inheritance
- Uri
- Serializable
- Product
- Equals
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (Uri, B)
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- val authority: Authority
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def copy(scheme: String = scheme, authority: Authority = authority, path: Path = path, rawQueryString: Option[String] = rawQueryString, fragment: Option[String] = fragment): Uri
Returns a copy of this Uri with the given components.
Returns a copy of this Uri with the given components.
If you want to use the copy constructor to update the 'rawQueryString', it is up to you to make sure the query string does not contain invalid characters. For this reason we recommend using Uri#withRawQueryString() instead.
- def effectivePort: Int
The effective port of this Uri given the currently set authority and scheme values.
The effective port of this Uri given the currently set authority and scheme values. If the authority has an explicitly set port (i.e. a non-zero port value) then this port is the effective port. Otherwise the default port for the current scheme is returned.
- def ensuring(cond: (Uri) => Boolean, msg: => Any): Uri
- def ensuring(cond: (Uri) => Boolean): Uri
- def ensuring(cond: Boolean, msg: => Any): Uri
- def ensuring(cond: Boolean): Uri
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- val fragment: Option[String]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- val path: Path
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def query(charset: Charset = UTF8, mode: ParsingMode = Uri.ParsingMode.Relaxed): Query
Parses the rawQueryString member into a Query instance.
- def queryString(charset: Charset = UTF8): Option[String]
Returns the query part of the Uri in its decoded form.
- val rawQueryString: Option[String]
- def resolvedAgainst(base: Uri): Uri
Returns a new absolute Uri that is the result of the resolution process defined by http://tools.ietf.org/html/rfc3986#section-5.2.2 The given base Uri must be absolute.
- val scheme: String
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toEffectiveHttpRequestUri(hostHeaderHost: Host, hostHeaderPort: Int, securedConnection: Boolean = false, defaultAuthority: Authority = Authority.Empty): Uri
Converts this URI to an "effective HTTP request URI" as defined by http://tools.ietf.org/html/rfc7230#section-5.5
- def toEffectiveRequestUri(hostHeaderHost: Host, hostHeaderPort: Int, defaultScheme: String, defaultAuthority: Authority = Authority.Empty): Uri
Converts this URI to an "effective request URI" as defined by http://tools.ietf.org/html/rfc7230#section-5.5
- def toHttpRequestTargetOriginForm: Uri
Converts this URI into an HTTP request target "origin-form" as defined by https://tools.ietf.org/html/rfc7230#section-5.3.
Converts this URI into an HTTP request target "origin-form" as defined by https://tools.ietf.org/html/rfc7230#section-5.3.
Note that the resulting URI instance is not a valid RFC 3986 URI! (As it might be a "relative" URI with a part component starting with a double slash.)
- def toRelative: Uri
Converts this URI into a relative URI by keeping the path, query and fragment, but dropping the scheme and authority.
- def toString(): String
- Definition Classes
- Uri → AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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()
- def withAuthority(host: String, port: Int): Uri
Returns a copy of this Uri with a Authority created using the given host and port.
- def withAuthority(host: Host, port: Int, userinfo: String = ""): Uri
Returns a copy of this Uri with a Authority created using the given host, port and userinfo.
- def withAuthority(authority: Authority): Uri
Returns a copy of this Uri with the given authority.
- def withFragment(fragment: String): Uri
Returns a copy of this Uri with the given fragment.
- def withHost(host: String): Uri
Returns a copy of this Uri with the given host.
- def withHost(host: Host): Uri
Returns a copy of this Uri with the given host.
- def withPath(path: Path): Uri
Returns a copy of this Uri with the given path.
- def withPort(port: Int): Uri
Returns a copy of this Uri with the given port.
- def withQuery(query: Query): Uri
Returns a copy of this Uri with the given query.
- def withRawQueryString(rawQueryString: String, mode: ParsingMode): Uri
Returns a copy of this Uri with the given query string.
Returns a copy of this Uri with the given query string.
Characters that are not within the range described at https://tools.ietf.org/html/rfc3986#section-3.4 must be percent-encoded. Characters that are in that range may or may not be percent-encoded, and depending on how the query string is parsed this might be relevant: for example, when interpreting the query string as 'key=value' pairs you could use the percent-encoded '=' ('%22) to include a '=' in the key or value.
- mode
depending on the mode, characters outside of the range allowed by RFC3986 will either cause an
IllegalUriException
or be automatically percent-encoded. Be aware that relying on automatic percent-encoding is usually a programming error.
- def withRawQueryString(rawQuery: String): Uri
Returns a copy of this Uri with the given query string.
Returns a copy of this Uri with the given query string.
Characters that are not within the range described at https://tools.ietf.org/html/rfc3986#section-3.4 should be percent-encoded. Characters that are in that range may or may not be percent-encoded, and depending on how the query string is parsed this might be relevant: for example, when interpreting the query string as 'key=value' pairs you could use the percent-encoded '=' ('%22) to include a '=' in a key or value.
When characters are encountered that are outside of the RFC3986 range they are automatically percent-encoded, but be aware that relying on this is usually a programming error.
- def withScheme(scheme: String): Uri
Returns a copy of this Uri with the given scheme.
Returns a copy of this Uri with the given scheme. The
scheme
change of the Uri has the following effect on the port value:- If the Uri has a non-default port for the scheme before the change this port will remain unchanged.
- If the Uri has the default port for the scheme before the change it will have the default port for the new scheme after the change.
- def withUserInfo(userinfo: String): Uri
Returns a copy of this Uri with the given userinfo.
- def withoutFragment: Uri
Drops the fragment from this URI
Deprecated Value Members
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from Uri toStringFormat[Uri] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (Uri, B)
- Implicit
- This member is added by an implicit conversion from Uri toArrowAssoc[Uri] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.