This is the common supertype for both hierarchical URLs (URI) and
opaque/non-hierarchical URLs (GUID). The scheme and host are always
stored in lowercase per the relevant specifications. The port and path may
be null depending on the URL type.
Two URLWithScheme instances are considered equal if their scheme,
host, port, and path are all equal.
- Author:
- Salvation Team
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedURLWithScheme(String scheme, String host, Integer port, String path) Constructs a URL with the given components. -
Method Summary
-
Constructor Details
-
URLWithScheme
Constructs a URL with the given components.The scheme is lowercased. The host, if non-
null, is also lowercased. The port and path are stored as-is.- Parameters:
scheme- the URL scheme (e.g."https","javascript"); will be lowercasedhost- the host component, ornullif not applicable; will be lowercased if non-nullport- the port number, ornullif not applicablepath- the path component, ornullif not applicable
-
-
Method Details
-
getScheme
Returns the scheme component of this URL, in lowercase.- Returns:
- the scheme (e.g.
"https","data","javascript")
-
getHost
Returns the host component of this URL, in lowercase.- Returns:
- the host, or
nullif this URL has no host (e.g. forGUIDURLs likedata:orjavascript:)
-
getPort
Returns the port component of this URL.- Returns:
- the port number, or
nullif this URL has no port
-
getPath
Returns the path component of this URL.For
URIinstances this is the path portion of the hierarchical URL (e.g."/scripts/app.js"). ForGUIDinstances this is the opaque data after the scheme (e.g. the source code in ajavascript:URL).- Returns:
- the path, or
nullif not applicable
-
equals
Two
URLWithSchemeinstances are equal if their scheme, host, port, and path are all equal. -
hashCode
public int hashCode()
-