Skip to content

//okhttp/okhttp3/HttpUrl/Companion

Companion

[jvm]\ object Companion

Functions

Name Summary
defaultPort [jvm]
@JvmStatic
fun defaultPort(scheme: String): Int
Returns 80 if scheme.equals("http"), 443 if scheme.equals("https") and -1 otherwise.
toHttpUrl [jvm]
@JvmStatic
@JvmName(name = "get")
fun String.toHttpUrl(): HttpUrl
Returns a new HttpUrl representing this.
toHttpUrlOrNull [jvm]
@JvmStatic
@JvmName(name = "get")
fun URI.toHttpUrlOrNull(): HttpUrl?
[jvm]
@JvmStatic
@JvmName(name = "get")
fun URL.toHttpUrlOrNull(): HttpUrl?
Returns an HttpUrl for this if its protocol is http or https, or null if it has any other protocol.
[jvm]
@JvmStatic
@JvmName(name = "parse")
fun String.toHttpUrlOrNull(): HttpUrl?
Returns a new HttpUrl representing url if it is a well-formed HTTP or HTTPS URL, or null if it isn’t.