sealed trait Url extends Uri
Represents a URL, which will be one of these forms:
- Absolute:
http://example.com
- Protocol Relative:
//example.com
- Without Authority:
mailto:[email protected]
- Root Relative:
/index.html?a=b
- Rootless Relative:
index.html?a=b
- Rootless Relative
(with doc segment):
../index.html?a=b
- Alphabetic
- By Inheritance
- Url
- Uri
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract type Self <: Url
- abstract type SelfWithAuthority <: UrlWithAuthority
- abstract type SelfWithScheme <: UrlWithScheme
Abstract Value Members
- abstract def authorityOption: Option[Authority]
- abstract def canEqual(that: Any): Boolean
- Definition Classes
- Equals
- implicit abstract def config: UriConfig
- Definition Classes
- Uri
- abstract def fragment: Option[String]
- abstract def hostOption: Option[Host]
- abstract def longestSubdomain: Option[String]
Returns the longest subdomain for this URL's host.
Returns the longest subdomain for this URL's host. E.g. for http://a.b.c.example.com returns a.b.c.example
- returns
the longest subdomain for this URL's host
- abstract def mapPassword(f: (String) => String): Self
Transforms this URL by applying the specified Function to the password if it exists
- abstract def mapUser(f: (String) => String): Self
Transforms this URL by applying the specified Function to the user if it exists
- abstract def normalize(removeEmptyPathParts: Boolean = false, slashTermination: SlashTermination = SlashTermination.AddForEmptyPath): Self
Normalizes this
- abstract def password: Option[String]
- abstract def path: UrlPath
- abstract def port: Option[Int]
- abstract def productArity: Int
- Definition Classes
- Product
- abstract def productElement(n: Int): Any
- Definition Classes
- Product
- abstract def publicSuffix: Option[String]
Returns the longest public suffix for the host in this URI.
Returns the longest public suffix for the host in this URI. Examples include:
com
forwww.example.com
co.uk
forwww.example.co.uk
- returns
the longest public suffix for the host in this URI
- abstract def publicSuffixes: Vector[String]
Returns all longest public suffixes for the host in this URI.
Returns all longest public suffixes for the host in this URI. Examples include:
com
forwww.example.com
co.uk
anduk
forwww.example.co.uk
- returns
all public suffixes for the host in this URI
- abstract def query: QueryString
- abstract def removePassword(): Self
Removes any password from this URL's user-info
Removes any password from this URL's user-info
- returns
This URL without the password
- abstract def removeUserInfo(): Self
Removes the user-info (both user and password) from this URL
Removes the user-info (both user and password) from this URL
- returns
This URL without the user-info
- abstract def schemeOption: Option[String]
- Definition Classes
- Uri
- abstract def shortestSubdomain: Option[String]
Returns the shortest subdomain for this URL's host.
Returns the shortest subdomain for this URL's host. E.g. for http://a.b.c.example.com returns a
- returns
the shortest subdomain for this URL's host
- abstract def subdomain: Option[String]
Returns the second largest subdomain for this URL's host.
Returns the second largest subdomain for this URL's host.
E.g. for http://a.b.c.example.com returns a.b.c
Note: In the event there is only one subdomain (i.e. the host is the apex domain), this method returns
None
. E.g. This method will returnNone
forhttp://example.com
.- returns
the second largest subdomain for this URL's host
- abstract def subdomains: Vector[String]
Returns all subdomains for this URL's host.
Returns all subdomains for this URL's host. E.g. for http://a.b.c.example.com returns a, a.b, a.b.c and a.b.c.example
- returns
all subdomains for this URL's host
- abstract def user: Option[String]
- abstract def withAuthority(authority: Authority): SelfWithAuthority
Copies this Url but with the authority set as the given value.
Copies this Url but with the authority set as the given value.
- authority
the authority to set
- returns
a new Url with the specified authority
- abstract def withConfig(config: UriConfig): Self
Copies this Uri but with a new UriConfig
Copies this Uri but with a new UriConfig
- config
the new config to use
- returns
a new Uri with the specified config
- Definition Classes
- Uri
- abstract def withFragment[T](fragment: T)(implicit arg0: Fragment[T]): Self
Copies this Url but with the fragment set as the given value.
Copies this Url but with the fragment set as the given value.
- fragment
the new fragment to set
- returns
a new Url with the specified fragment
- abstract def withHost(host: Host): SelfWithAuthority
Copies this Url but with the host set as the given value.
Copies this Url but with the host set as the given value.
- host
the new host to set
- returns
a new Url with the specified host
- abstract def withPath(path: UrlPath): Self
Copies this Url but with the path set as the given value.
Copies this Url but with the path set as the given value.
- path
the new path to set
- returns
a new Url with the specified path
- abstract def withQueryString(query: QueryString): Self
Copies this Url but with the query set as the given value.
Copies this Url but with the query set as the given value.
- query
the new QueryString to set
- returns
a new Url with the specified query
- abstract def withScheme(scheme: String): SelfWithScheme
Copies this Uri but with the scheme set as the given value.
Copies this Uri but with the scheme set as the given value.
- scheme
the new scheme to set
- returns
a new Uri with the specified scheme
- Definition Classes
- Uri
Concrete 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, V](k: K, v: V)(implicit arg0: QueryKey[K], arg1: QueryValue[V]): Self
Adds a new Query String parameter key-value pair.
Adds a new Query String parameter key-value pair.
Pairs with values, such as
Some("value")
, represent query params with values, i.e?param=value
By default, pairs without values, i.e
None
, represent query params without values, i.e?param
Using aUriConfig(renderQuery = ExcludeNones)
, will cause pairs withNone
values not to be rendered- k
value that provides a name pair for the parameter. Can be a any basic value type or a custom type if you provide a
QueryKey
type-class- v
value that provides a value for the parameter. Can be a any basic value type or a custom type if you provide a
QueryValue
type-class- returns
A new Url with the new Query String parameter
- def addParam[A](a: A)(implicit arg0: QueryKeyValue[A]): Self
Adds a new Query String parameter key-value pair.
Adds a new Query String parameter key-value pair.
Pairs with values, such as
Some("value")
, represent query params with values, i.e?param=value
By default, pairs without values, i.e
None
, represent query params without values, i.e?param
Using aUriConfig(renderQuery = ExcludeNones)
, will cause pairs withNone
values not to be rendered- a
value that provides a name/value pair for the parameter. Can be a Tuple of any basic value types or a custom type if you provide a
QueryKeyValue
type-class- returns
A new Url with the new Query String parameter
- def addParams[KV](first: KV, second: KV, params: KV*)(implicit arg0: QueryKeyValue[KV]): Self
Adds all the specified key-value pairs as parameters to the query
Adds all the specified key-value pairs as parameters to the query
- params
A list of key-value pairs to add as query parameters
- returns
A new Url with the new Query String parameters
- def addParams[A](params: A)(implicit arg0: TraversableParams[A]): Self
Adds all the specified key-value pairs as parameters to the query
Adds all the specified key-value pairs as parameters to the query
- params
A list of key-value pairs to add as query parameters
- returns
A new Url with the new Query String parameters
- def addPathPart[P](part: P)(implicit arg0: PathPart[P]): Self
- def addPathParts[P](first: P, second: P, parts: P*)(implicit arg0: PathPart[P]): Self
- def addPathParts[P](parts: P)(implicit arg0: TraversablePathParts[P]): Self
- def apexDomain: Option[String]
Returns the apex domain for this URL.
Returns the apex domain for this URL.
The apex domain is constructed from the public suffix for this URL's host prepended with the immediately preceding dot segment.
Examples include:
example.com
forwww.example.com
example.co.uk
forwww.example.co.uk
- returns
the apex domain for this URL
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def collectQuery[KV](f: PartialFunction[(String, Option[String]), KV])(implicit arg0: QueryKeyValue[KV]): Self
Transforms the Query String by applying the specified PartialFunction to each Query String Parameter
Transforms the Query String by applying the specified PartialFunction to each Query String Parameter
Parameters not defined in the PartialFunction will be removed.
- f
A function that returns a new Parameter when applied to each Parameter
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def equalsUnordered(other: Uri): Boolean
Similar to
==
but ignores the ordering of any query string parameters - def filterQuery(f: ((String, Option[String])) => Boolean): Self
Removes any Query String Parameters that return false when applied to the given Function
- def filterQueryNames(f: (String) => Boolean): Self
Removes any Query String Parameters that return false when their name is applied to the given Function
- def filterQueryValues(f: (String) => Boolean): Self
Removes any Query String Parameters that return false when their value is applied to the given Function
- def flatMapQuery[A](f: ((String, Option[String])) => A)(implicit arg0: TraversableParams[A]): Self
Transforms the Query String by applying the specified Function to each Query String Parameter
Transforms the Query String by applying the specified Function to each Query String Parameter
- f
A function that returns a collection of Parameters when applied to each parameter
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def mapQuery[KV](f: PartialFunction[(String, Option[String]), KV])(implicit arg0: QueryKeyValue[KV]): Self
Transforms the Query String by applying the specified PartialFunction to each Query String Parameter
Transforms the Query String by applying the specified PartialFunction to each Query String Parameter
Parameters not defined in the PartialFunction will be left as-is.
- f
A function that returns a new Parameter when applied to each Parameter
- def mapQueryNames[K](f: (String) => K)(implicit arg0: QueryKey[K]): Self
Transforms the Query String by applying the specified Function to each Query String Parameter name
Transforms the Query String by applying the specified Function to each Query String Parameter name
- f
A function that returns a new Parameter name when applied to each Parameter name
- def mapQueryValues[V](f: (String) => V)(implicit arg0: QueryValue[V]): Self
Transforms the Query String by applying the specified Function to each Query String Parameter value
Transforms the Query String by applying the specified Function to each Query String Parameter value
- f
A function that returns a new Parameter value when applied to each Parameter value
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def productElementName(n: Int): String
- Definition Classes
- Product
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def productIterator: Iterator[Any]
- Definition Classes
- Product
- def productPrefix: String
- Definition Classes
- Product
- def queryToString(config: UriConfig): String
- Attributes
- protected
- def removeEmptyPathParts(): Self
- def removeParams[K](k: Iterable[K])(implicit arg0: QueryKey[K]): Self
Removes all Query String parameters with a name in the specified list
Removes all Query String parameters with a name in the specified list
- k
Names of Query String parameter(s) to remove
- def removeParams[K](first: K, second: K, rest: K*)(implicit arg0: QueryKey[K]): Self
Removes all Query String parameters with a name in the specified list
Removes all Query String parameters with a name in the specified list
- first
Name of a Query String parameter to remove
- second
Name of another Query String parameter to remove
- rest
Name of more Query String parameter(s) to remove
- def removeParams[K](k: K)(implicit arg0: QueryKey[K]): Self
Removes all Query String parameters with the specified key
Removes all Query String parameters with the specified key
- k
Key for the Query String parameter(s) to remove
- def removeQueryString(): Self
Removes all Query String parameters
- def replaceParams[K, V](k: K, v: V)(implicit arg0: QueryKey[K], arg1: QueryValue[V]): Self
Replaces the all existing Query String parameters with the specified key with a single Query String parameter with the specified value.
Replaces the all existing Query String parameters with the specified key with a single Query String parameter with the specified value.
Pairs with values, such as
("param", Some("value"))
, represent query params with values, i.e?param=value
By default, pairs without values, such as
("param", None)
, represent query params without values, i.e?param
Using aUriConfig(renderQuery = ExcludeNones)
, will cause pairs withNone
values not to be rendered- k
Key for the Query String parameter(s) to replace
- v
value to replace with
- returns
A new Uri with the result of the replace
- def resolve(base: UrlWithScheme, strict: Boolean = false): UrlWithScheme
- returns
this URL resolved with the given URL as the base according to section 5.2.2 Transform References of RFC 3986.
- def slashTerminated(slashTermination: SlashTermination = SlashTermination.AddForAll): Self
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toAbsoluteUrl: AbsoluteUrl
- def toJavaURI: URI
Converts to a
java.net.URI
Converts to a
java.net.URI
This involves a
toString
andURI.parse
because the specificjava.net.URI
constructors do not deal properly with encoded elements- returns
a
java.net.URI
matching thisio.lemonlabs.uri.Uri
- Definition Classes
- Uri
- def toProtocolRelativeUrl: ProtocolRelativeUrl
- def toRedactedString(redactor: Redactor)(implicit conf: UriConfig = UriConfig.default): String
- def toRelativeUrl: RelativeUrl
- def toString(): String
- Definition Classes
- Uri → AnyRef → Any
- def toStringPunycode: String
- returns
the URL as a String. If the URI has a domain name for a host, any unicode characters will be returned in ASCII Compatible Encoding (ACE), as defined by the ToASCII operation of RFC 3490.
- def toStringRaw: String
Returns the path with no encoders taking place (e.g.
Returns the path with no encoders taking place (e.g. non ASCII characters will not be percent encoded)
- returns
String containing the raw path for this Uri
- Definition Classes
- Uri
- def toUrl: Url
- def toUrn: Urn
- 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 withHost(host: String): SelfWithAuthority
Copies this Url but with the host set as the given value.
Copies this Url but with the host set as the given value.
- host
the new host to set
- returns
a new Url with the specified host
- def withPathParts[P](parts: P)(implicit arg0: TraversablePathParts[P]): Self
Copies this Url but with the path set as the given value.
Copies this Url but with the path set as the given value.
- parts
the parts that make up the new path
- returns
a new Url with the specified path
- def withQueryString[KV](first: KV, second: KV, params: KV*)(implicit arg0: QueryKeyValue[KV]): Self
Replaces the all existing Query String parameters with a new set of query params
- def withQueryString[T](params: T)(implicit arg0: TraversableParams[T]): Self
Replaces the all existing Query String parameters with a new set of query params
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated