APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.net.http

public final Record Origin

extends Record
Class Inheritance
Record Components
scheme:String
The scheme of the origin (for example: https). Unlike the application layer protocol (which can be a finer grained protocol like h2, h3 etc...), this is actually a scheme. Only http and https literals are supported. Cannot be null.
host:String
The host of the origin, cannot be null. If the host is an IPv6 address, then it must not be enclosed in square brackets ('[' and ']'). If the host is a DNS hostname, then it must be passed as a lower case String.
port:int
The port of the origin. Must be greater than 0.
Imports
java.net.URI, .URISyntaxException, java.util.Locale, .Objects, sun.net.util.IPAddressUtil

Represents an origin server to which a HTTP request is targeted.

Field Summary

Modifier and TypeField and Description
private final String
host

Record Component accessed by host().

The host of the origin, cannot be null.
private final int
port

Record Component accessed by port().

The port of the origin.
private final String
scheme

Record Component accessed by scheme().

The scheme of the origin (for example: https).

Constructor Summary

AccessConstructor and Description
public
Origin(String scheme, String host, int port)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public static Origin

Returns:

Creates and returns an Origin from an URI
from
(final URI
The URI of the origin
uri
)

Returns Creates and returns an Origin from an URI.

pack-priv static Origin

Returns:

Creates and returns an Origin parsed from the ASCII serialized form as defined in section 6.2 of RFC-6454
fromASCIISerializedForm
(final String
The value to be parsed
value
)

Returns Creates and returns an Origin parsed from the ASCII serialized form as defined in section 6.2 of RFC-6454.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public String
host()

Record Component getter of host.

Record Component The host of the origin, cannot be null.

private static boolean
isDNSHostName(final String host)

pack-priv boolean

Returns:

true if the Origin's scheme is considered secure, else returns false
isSecure
()

Returns true if the Origin's scheme is considered secure, else returns false.

private static boolean
isValidScheme(final String scheme)

public int
port()

Record Component getter of port.

Record Component The port of the origin.

public String
scheme()

Record Component getter of scheme.

Record Component The scheme of the origin (for example: https).

pack-priv static String
toAuthority(final String host, final int port)

public String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

Field Detail

hostback to summary
private final String host

Record Component accessed by host().

The host of the origin, cannot be null. If the host is an IPv6 address, then it must not be enclosed in square brackets ('[' and ']'). If the host is a DNS hostname, then it must be passed as a lower case String.

portback to summary
private final int port

Record Component accessed by port().

The port of the origin. Must be greater than 0.

schemeback to summary
private final String scheme

Record Component accessed by scheme().

The scheme of the origin (for example: https). Unlike the application layer protocol (which can be a finer grained protocol like h2, h3 etc...), this is actually a scheme. Only http and https literals are supported. Cannot be null.

Constructor Detail

Originback to summary
public Origin(String scheme, String host, int port)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
fromback to summary
public static Origin from(final URI uri) throws IllegalArgumentException

Returns Creates and returns an Origin from an URI.

Parameters
uri:URI

The URI of the origin

Returns:Origin

Creates and returns an Origin from an URI

Exceptions
IllegalArgumentException:
if a Origin cannot be constructed from the given uri
fromASCIISerializedFormback to summary
pack-priv static Origin fromASCIISerializedForm(final String value) throws IllegalArgumentException

Returns Creates and returns an Origin parsed from the ASCII serialized form as defined in section 6.2 of RFC-6454.

Parameters
value:String

The value to be parsed

Returns:Origin

Creates and returns an Origin parsed from the ASCII serialized form as defined in section 6.2 of RFC-6454

hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

hostback to summary
public String host()

Record Component getter of host.

Record Component
The host of the origin, cannot be null. If the host is an IPv6 address, then it must not be enclosed in square brackets ('[' and ']'). If the host is a DNS hostname, then it must be passed as a lower case String.
isDNSHostNameback to summary
private static boolean isDNSHostName(final String host)
isSecureback to summary
pack-priv boolean isSecure()

Returns true if the Origin's scheme is considered secure, else returns false.

Returns:boolean

true if the Origin's scheme is considered secure, else returns false

isValidSchemeback to summary
private static boolean isValidScheme(final String scheme)
portback to summary
public int port()

Record Component getter of port.

Record Component
The port of the origin. Must be greater than 0.
schemeback to summary
public String scheme()

Record Component getter of scheme.

Record Component
The scheme of the origin (for example: https). Unlike the application layer protocol (which can be a finer grained protocol like h2, h3 etc...), this is actually a scheme. Only http and https literals are supported. Cannot be null.
toAuthorityback to summary
pack-priv static String toAuthority(final String host, final int port)
toStringback to summary
public String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

Annotations
@Override