java.lang.Object
org.miaixz.bus.http.Route
Represents a specific route to an origin server chosen by the HTTP client when making a connection.
A route encapsulates the specific configuration for a connection, including the target address, the proxy to use, and the socket address. Each route is an immutable instance representing a concrete choice of the client's connection options (like proxy selection, TLS configuration).
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
ConstructorsConstructorDescriptionRoute(Address address, Proxy proxy, InetSocketAddress inetSocketAddress) Constructs a newRouteinstance. -
Method Summary
Modifier and TypeMethodDescriptionaddress()Returns the address configuration for the target server.booleanCompares this route to another object for equality.inthashCode()Computes the hash code for this route.proxy()Returns the proxy used for this route.booleanReturns whether this route requires an HTTPS tunnel through an HTTP proxy.Returns the target socket address.toString()Returns a string representation of this route.
-
Constructor Details
-
Route
Constructs a newRouteinstance.- Parameters:
address- The address configuration for the target server.proxy- The proxy to use for the connection.inetSocketAddress- The target socket address.- Throws:
NullPointerException- if address, proxy, or inetSocketAddress is null.
-
-
Method Details
-
address
Returns the address configuration for the target server.- Returns:
- The
Addressobject.
-
proxy
Returns the proxy used for this route.Warning: This may be different from the proxy in the address configuration if a proxy selector is used and the address does not specify a proxy.
- Returns:
- The
Proxyobject.
-
socketAddress
Returns the target socket address.- Returns:
- The
InetSocketAddressobject, representing the target IP and port.
-
requiresTunnel
public boolean requiresTunnel()Returns whether this route requires an HTTPS tunnel through an HTTP proxy.- Returns:
trueif this route requires an HTTPS tunnel.
-
equals
Compares this route to another object for equality.Two routes are equal if their address, proxy, and socket address are all equal.
-
hashCode
public int hashCode()Computes the hash code for this route. -
toString
Returns a string representation of this route.
-