sealed abstract case class Uri extends Product with Serializable
An immutable model of an internet URI as defined by http://tools.ietf.org/html/rfc3986. All members of this class represent the *decoded* URI elements (i.e. without percent-encoding).
- Source
- Uri.scala
- Alphabetic
- By Inheritance
- Uri
- Serializable
- Serializable
- Product
- Equals
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Concrete Value Members
- val authority: Authority
-
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.
-
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.
- val fragment: Option[String]
- def isAbsolute: Boolean
- def isRelative: Boolean
- val path: Path
-
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
-
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
-
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(rawQuery: String): Uri
Returns a copy of this Uri with a Query created using the given query string.
-
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