Module jls.net.URL
Represents an URL.
Class URL
URL:new (protocol, host, port, file) | Creates a new URL. |
url:getHost () | Returns this URL hostname. |
url:getPort () | Returns this URL port. |
url:toString () | Returns the string value representing this URL. |
URL.parse (url) | Returns the URL corresponding to the specified string. |
URL.fromString (url) | Returns the URL corresponding to the specified string. |
Class URL
The URL class represents an Uniform Resource Locator.
see https://tools.ietf.org/html/rfc1738
- URL:new (protocol, host, port, file)
-
Creates a new URL.
Parameters:
- protocol The protocol or the URL as a string.
- host The host name.
- port The port number.
- file The file part of the URL.
Returns:
-
a new URL
Usage:
local url = URL:new('http://somehost:1234/some/path') url:getHost() -- returns "somehost"
- url:getHost ()
-
Returns this URL hostname.
Returns:
-
this URL hostname.
- url:getPort ()
-
Returns this URL port.
Returns:
-
this URL port.
- url:toString ()
-
Returns the string value representing this URL.
Returns:
-
the string value representing this URL.
- URL.parse (url)
-
Returns the URL corresponding to the specified string.
Parameters:
- url string The string to parse.
Returns:
-
table
a table representing the URL or nil.
- URL.fromString (url)
-
Returns the URL corresponding to the specified string.
Parameters:
- url string The URL as a string.
Returns:
-
jls.net.URL
the URL or nil.