java.lang.Object
java.lang.Record
org.htmlunit.csp.value.Host
- Record Components:
scheme- the scheme part (e.g."https"), ornullif not specifiedhost- the host part, lowercased (e.g."example.com"or"*.cdn.example.com")port- the port number,Constants.EMPTY_PORTif not specified, orConstants.WILDCARD_PORTif:*path- the path part (e.g."/scripts/"), ornullif not specified
Represents a CSP host-source value, e.g.
https://example.com:443/path.
A host-source consists of an optional scheme, a required host name
(which may use a leading wildcard like *.example.com), an optional
port (which may be a wildcard *), and an optional path.
The host portion is always lowercased during parsing per the CSP specification.
- Author:
- Salvation Team
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.host()Returns the value of thehostrecord component.Parses a host-source from its CSP string representation.path()Returns the value of thepathrecord component.intport()Returns the value of theportrecord component.scheme()Returns the value of theschemerecord component.toString()Returns the CSP string representation of this host-source.
-
Constructor Details
-
Method Details
-
parseHost
Parses a host-source from its CSP string representation.The input is matched against the host-source grammar. The scheme, if present, is lowercased. The host is always lowercased. The port may be a number, the wildcard
*, or absent. The path, if present, is preserved as-is. -
toString
Returns the CSP string representation of this host-source.The scheme is included only if it was explicitly specified. The port is omitted if it is the default port for the scheme or was not specified. The path is included only if it was explicitly specified.
-
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
scheme
Returns the value of theschemerecord component.- Returns:
- the value of the
schemerecord component
-
host
Returns the value of thehostrecord component.- Returns:
- the value of the
hostrecord component
-
port
public int port()Returns the value of theportrecord component.- Returns:
- the value of the
portrecord component
-
path
Returns the value of thepathrecord component.- Returns:
- the value of the
pathrecord component
-