java.lang.Object
org.miaixz.bus.http.Address
A specification for a connection to an origin server. For an HTTP client, this is the server that terminates the HTTP
request.
This class holds the configuration for a connection, including the server's hostname, port, proxy, and security
settings. HTTP requests that share the same Address may also share the same underlying Connection.
- Since:
- Java 17+
- Author:
- Kimi Liu
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAddress(String uriHost, int uriPort, DnsX dns, SocketFactory socketFactory, SSLSocketFactory sslSocketFactory, HostnameVerifier hostnameVerifier, CertificatePinner certificatePinner, Authenticator proxyAuthenticator, Proxy proxy, List<org.miaixz.bus.core.net.Protocol> protocols, List<ConnectionSuite> connectionSuites, ProxySelector proxySelector) Constructs a new Address. -
Method Summary
Modifier and TypeMethodDescriptionReturns the certificate pinner for this address, or null if this is not an HTTPS address.Returns the list of connection suites supported by this address.dns()Returns the DNS service used to resolve hostnames for this address.booleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for the object.Returns the hostname verifier for this address, or null if this is not an HTTPS address.List<org.miaixz.bus.core.net.Protocol> Returns the list of protocols supported by this address, such ashttp/1.1andh2.proxy()Returns this address's explicitly specified proxy.Returns the authenticator for proxy servers.Returns this address's proxy selector.Returns the socket factory for this address.Returns the SSL socket factory for this address, or null if this is not an HTTPS address.toString()Returns a string representation of this address, including the host, port, and proxy information.url()Returns the URL of the origin server.
-
Constructor Details
-
Address
public Address(String uriHost, int uriPort, DnsX dns, SocketFactory socketFactory, SSLSocketFactory sslSocketFactory, HostnameVerifier hostnameVerifier, CertificatePinner certificatePinner, Authenticator proxyAuthenticator, Proxy proxy, List<org.miaixz.bus.core.net.Protocol> protocols, List<ConnectionSuite> connectionSuites, ProxySelector proxySelector) Constructs a new Address.- Parameters:
uriHost- the hostname of the origin server.uriPort- the port of the origin server.dns- the DNS service.socketFactory- the socket factory.sslSocketFactory- the SSL socket factory, or null for non-HTTPS connections.hostnameVerifier- the hostname verifier, or null for non-HTTPS connections.certificatePinner- the certificate pinner, or null for non-HTTPS connections.proxyAuthenticator- the proxy authenticator.proxy- the explicit proxy, or null to use the proxy selector.protocols- the list of supported protocols.connectionSuites- the list of supported connection suites.proxySelector- the proxy selector.
-
-
Method Details
-
url
Returns the URL of the origin server.The path, query, and fragment of this URL are always empty.
- Returns:
- the server's URL.
-
dns
Returns the DNS service used to resolve hostnames for this address.- Returns:
- the DNS service.
-
socketFactory
Returns the socket factory for this address.- Returns:
- the socket factory.
-
proxyAuthenticator
Returns the authenticator for proxy servers.- Returns:
- the proxy authenticator.
-
protocols
Returns the list of protocols supported by this address, such ashttp/1.1andh2.- Returns:
- an immutable list of protocols.
-
connectionSpecs
Returns the list of connection suites supported by this address.- Returns:
- an immutable list of connection suites.
-
proxySelector
Returns this address's proxy selector.- Returns:
- the proxy selector.
-
proxy
Returns this address's explicitly specified proxy. This is null if a proxy selector is preferred.- Returns:
- the explicit proxy, which may be null.
-
sslSocketFactory
Returns the SSL socket factory for this address, or null if this is not an HTTPS address.- Returns:
- the SSL socket factory, or null.
-
hostnameVerifier
Returns the hostname verifier for this address, or null if this is not an HTTPS address.- Returns:
- the hostname verifier, or null.
-
certificatePinner
Returns the certificate pinner for this address, or null if this is not an HTTPS address.- Returns:
- the certificate pinner, or null.
-
equals
Indicates whether some other object is "equal to" this one. Two addresses are equal if they share the same URL and non-host properties. -
hashCode
public int hashCode()Returns a hash code value for the object. This is computed from the URL, DNS, proxy authenticator, protocols, connection suites, proxy selector, and SSL/TLS settings. -
toString
Returns a string representation of this address, including the host, port, and proxy information.
-