URL
classin packageklyn.net
public class URL extends Object
└ URL

Parsed URL value.

Supported schemes for toHttpRequest() are http and https.

import klyn.net

url = URL("https://example.com:8443/api?q=1#frag")
print(url.protocol)
print(url.host)
print(url.effectivePort)
Properties
Modifier and Type Member Description
public readonly property authority
authority as String
Authority component as written in the URL.
public readonly property defaultPort
defaultPort as Int
Returns the default port for the current scheme.
public readonly property effectivePort
effectivePort as Int
Returns the explicit port or the scheme default port.
public readonly property file
file as String
Returns the file component (path plus optional query string).
public readonly property fragment
fragment as String
Fragment component without #.
public readonly property host
host as String
Host or bracketed IPv6 literal.
public readonly property isHttps
isHttps as Boolean
Returns true for https URLs.
public readonly property path
path as String
Path component, defaulting to /.
public readonly property port
port as Int
Explicit port or -1 when omitted.
public readonly property protocol
protocol as String
Lower-case URL scheme.
public readonly property query
query as String
Query component without ?.
Inherited Properties
propertyInherited Properties from Object: type
Constructors
Modifier and Type Member Description
public URL Parses a URL string.
Methods
Modifier and Type Member Description
public static fromObject
fromObject(value as Object) as URL throws MalformedURLException
Converts an object to URL.
public toExternalForm
toExternalForm() as String
Alias of toString().
public toHttpRequest
toHttpRequest(method as String = "GET", headers as Map<String, String> = null, body as Object = null) as HttpRequest throws Exception
Builds an HTTP request targeting this URL.
public override toString
toString() as String
No summary.
Inherited Methods
methodInherited Methods from Object: deepCopy, fromJson, hash, toDict, toJson, toMap, toString, toXml