ktor-http / io.ktor.http / Url

Url

data class Url

Represents an immutable URL

Constructors

<init>

Url(protocol: URLProtocol, host: String, specifiedPort: Int, encodedPath: String, parameters: Parameters, fragment: String, user: String?, password: String?, trailingQuery: Boolean)

Represents an immutable URL

Properties

encodedPath

val encodedPath: String

encoded path without query string

fragment

val fragment: String

URL fragment (anchor name)

host

val host: String

name without port (domain)

parameters

val parameters: Parameters

URL query parameters

password

val password: String?

password part of URL

port

val port: Int

the specified port or protocol default port

protocol

val protocol: URLProtocol

specifiedPort

val specifiedPort: Int

port number that was specified to override protocol's default

trailingQuery

val trailingQuery: Boolean

keep trailing question character even if there are no query parameters

user

val user: String?

username part of URL

Functions

toString

fun toString(): String

Extension Properties

authority

val Url.authority: String

Url authority.

fullPath

val Url.fullPath: String

Full encoded path with query string but without domain, port and schema

hostWithPort

val Url.hostWithPort: String

Host:port pair, not normalized so port is always specified even if the port is schema's default

Extension Functions

toURI

fun Url.toURI(): URI

Convert Url to URI

Companion Object Extension Functions

invoke

operator fun Url.Companion.invoke(fullUrl: String): Url

Construct Url from String