java.lang.Object
org.htmlunit.csp.url.URLWithScheme
org.htmlunit.csp.url.URI
Represents a hierarchical URI with scheme, host, port, and path components.
This is the concrete URLWithScheme subclass used for standard URLs
such as https://example.com:443/path. For opaque/non-hierarchical URLs
(e.g. data: or javascript:), see GUID.
Instances can be created directly via the constructor or parsed from a string
using parseURI(String).
- Author:
- Salvation Team
-
Constructor Details
-
URI
Constructs a hierarchical URI with the given components.- Parameters:
scheme- the URI scheme (e.g."https"); will be lowercasedhost- the host name (e.g."example.com"); will be lowercasedport- the port number (usedefaultPortForProtocol(String)orConstants.EMPTY_PORTfor unspecified ports)path- the path component (e.g."/scripts/app.js"); use an empty string if no path is present
-
-
Method Details
-
parseURI
Parses a hierarchical URI from its string representation.The input must contain a scheme (e.g.
"https://example.com/path"). If no port is specified, the default port for the scheme is used. If no path is specified, an empty string is used. The host and scheme are lowercased. -
defaultPortForProtocol
Returns the default port number for the given protocol scheme.Known default ports:
Default ports by scheme Scheme Port ftp21 gopher70 http,ws80 https,wss443 fileConstants.EMPTY_PORTFor unrecognised schemes,
Constants.EMPTY_PORTis returned.- Parameters:
scheme- the protocol scheme in lowercase (e.g."https")- Returns:
- the default port number, or
Constants.EMPTY_PORTif the scheme has no default port - See Also:
-