public class URL extends Object:
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)| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | authorityauthority as String: |
Authority component as written in the URL. |
| public readonly property | defaultPortdefaultPort as Int: |
Returns the default port for the current scheme. |
| public readonly property | effectivePorteffectivePort as Int: |
Returns the explicit port or the scheme default port. |
| public readonly property | filefile as String: |
Returns the file component (`path` plus optional query string). |
| public readonly property | fragmentfragment as String: |
Fragment component without `#`. |
| public readonly property | hosthost as String: |
Host or bracketed IPv6 literal. |
| public readonly property | isHttpsisHttps as Boolean: |
Returns true for `https` URLs. |
| public readonly property | pathpath as String: |
Path component, defaulting to `/`. |
| public readonly property | portport as Int: |
Explicit port or `-1` when omitted. |
| public readonly property | protocolprotocol as String: |
Lower-case URL scheme. |
| public readonly property | queryquery as String: |
Query component without `?`. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | URLURL(spec as String) throws MalformedURLException: |
Parses a URL string. |
| Modifier and Type | Member | Description |
|---|---|---|
| public static | fromObjectfromObject(value as Object) as URL throws MalformedURLException: |
Converts an object to `URL`. |
| public | toExternalFormtoExternalForm() as String: |
Alias of `toString()`. |
| public | toHttpRequest | Builds an HTTP request targeting this URL. |
| public override | toStringtoString() as String: |
No summary. |