Module jls.net.Url

Represents an Uniform Resource Locator.

Class Url

Url:new (protocol[, host[, port[, file]]]) Creates a new Url.
url:getProtocol () Returns this Url scheme.
url:getUserInfo () Returns this Url userInfo.
url:getHost () Returns this Url hostname.
url:getPort () Returns this Url port.
url:getPath () Returns this Url path.
url:getQuery () Returns this Url query.
url:toString () Returns the string value representing this Url.
Url.parse (sUrl) Returns the Url corresponding to the specified string.
Url.fromString (sUrl) Returns the Url corresponding to the specified string.
Url.mapToQuery (keyValues) Returns the query representing the key value pairs.
Url.queryToMap (query) Returns the map containing the key value pairs from the specified query.
Url.format (tUrl) Returns the string value representing the specified Url.


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 or the Url as a table.
  • host string The host name. (optional)
  • port string The port number. (optional)
  • file string The file part of the Url. (optional)

Returns:

    a new Url

Usage:

    local url = Url:new('http://somehost:1234/some/path')
    url:getHost() -- returns "somehost"
url:getProtocol ()
Returns this Url scheme.

Returns:

    this Url scheme.
url:getUserInfo ()
Returns this Url userInfo.

Returns:

    this Url userInfo.
url:getHost ()
Returns this Url hostname.

Returns:

    this Url hostname.
url:getPort ()
Returns this Url port.

Returns:

    this Url port.
url:getPath ()
Returns this Url path.

Returns:

    this Url path.
url:getQuery ()
Returns this Url query.

Returns:

    this Url query.
url:toString ()
Returns the string value representing this Url.

Returns:

    the string value representing this Url.
Url.parse (sUrl)
Returns the Url corresponding to the specified string. The table contains the keys: scheme, host, port, path, query, userinfo, username, password.

Parameters:

  • sUrl string The string to parse.

Returns:

    table a table representing the Url or nil.
Url.fromString (sUrl)
Returns the Url corresponding to the specified string.

Parameters:

  • sUrl string The Url as a string.

Returns:

    jls.net.Url the Url or nil.
Url.mapToQuery (keyValues)
Returns the query representing the key value pairs.

Parameters:

  • keyValues table the key value pairs.

Returns:

    string the query representing the key value pairs.
Url.queryToMap (query)
Returns the map containing the key value pairs from the specified query.

Parameters:

Returns:

    table the query map.
Url.format (tUrl)
Returns the string value representing the specified Url.

Parameters:

  • tUrl table The Url as a table.

Returns:

    the string value representing the Url.
generated by LDoc 1.4.6