Parsed URL objects have some or all of the following fields, depending on whether or not they exist in the URL string. Any parts that are not in the URL string will not be in the parsed object.
Fields
optionalslashes:Null<Bool>
True if two ASCII forward-slash characters (/
) are required following the colon in the protocol
.
optionalsearch:Null<String>
The entire "query string" portion of the URL, including the leading ASCII question mark (?
) character.
For example: '?query=string'
No decoding of the query string is performed.
optionalquery:Null<EitherType<String, DynamicAccess<String>>>
Either the query string without the leading ASCII question mark (?
),
or an object returned by the Querystring.parse
method.
Whether the query
property is a string or object is determined by the parseQueryString
argument passed to Url.parse
.
For example: 'query=string' or {'query': 'string'}
If returned as a string, no decoding of the query string is performed. If returned as an object, both keys and values are decoded.
The type of this field can be implicitly converted to String
or DynamicAccess<String>
,
where either one is expected, so if you know the actual type, just assign it
to properly typed variable (e.g. var s:String = url.query)
optionalpathname:Null<String>
The entire path section of the URL. This is everything following the host
(including the port
) and
before the start of the query
or hash
components, delimited by either the ASCII question mark (?
) or
hash (#
) characters.
For example '/p/a/t/h'
No decoding of the path string is performed.
optionalpath:Null<String>
Concatenation of the pathname
and search
components.
For example: '/p/a/t/h?query=string'
No decoding of the path is performed.
optionalhref:Null<String>
The full URL string that was parsed with both the protocol
and host
components converted to lower-case.
For example: 'http://user:pass@host.com:8080/p/a/t/h?query=string#hash'
optionalhostname:Null<String>
The lower-cased host name portion of the host
component without the port
included.
For example: 'host.com'
optionalhost:Null<String>
The full lower-cased host portion of the URL, including the port
if specified.
For example: 'host.com:8080'
optionalhash:Null<String>
The "fragment" portion of the URL including the leading ASCII hash (#
) character.
For example: '#hash'
optionalauth:Null<String>
The username and password portion of the URL, also referred to as "userinfo".
This string subset follows the protocol
and double slashes (if present) and precedes the host
component,
delimited by an ASCII "at sign" (@
).
The format of the string is {username}[:{password}]
, with the [:{password}]
portion being optional.
For example: 'user:pass'