create
Constructor: From URL
Construct a copy of the provided URL object. Since the URL is already parsed, we can easily copy it without validating, as it was validated when it was first constructed.
Relative URLs are not allowed via this constructor.
Return
Copied URL object.
Parameters
URL to create a copy of.
See also
to create a URL from a string.
Constructor: From String
Construct a new URL object from the provided string. If the provided string is not a valid URL, an error is thrown. The resulting URL can be considered validated and well-formed.
Return
Parsed URL object.
Parameters
String to create a structured/parsed URL from.
See also
To create a URL from another URL.
Throws
If the provided string is not a valid URL.
Constructor: From String, with Base URL as String
Construct a new URL object from the provided string. If the provided string is not a valid URL, an error is thrown. The resulting URL can be considered validated and well-formed.
If url is relative, base is parsed first and used to resolve the effective absolute URL.
Return
Parsed URL object.
Parameters
String to create a structured/parsed URL from.
Base URL to use if url is relative.
See also
To create a URL from another URL.
Throws
If the provided string is not a valid URL.