public final class ConnectionInfo extends Object
Depending on the chosen factory method, the information
can be retrieved directly from the channel or additionally
using the "Forwarded"
, or "X-Forwarded-*"
HTTP request headers.
Modifier and Type | Method and Description |
---|---|
static int |
getDefaultHostPort(String scheme)
Returns the default host port number based on scheme
|
InetSocketAddress |
getHostAddress()
Return the host address of the connection.
|
String |
getHostName()
Returns the connection host name.
|
int |
getHostPort()
Returns the connection host port.
|
InetSocketAddress |
getRemoteAddress()
Return the remote address of the connection.
|
String |
getScheme()
Return the connection scheme.
|
ConnectionInfo |
withHostAddress(InetSocketAddress hostAddress)
Return a new
ConnectionInfo with the updated host address. |
ConnectionInfo |
withHostAddress(InetSocketAddress hostAddress,
String hostName,
int hostPort)
Return a new
ConnectionInfo with updated host address, host name, and host port information. |
ConnectionInfo |
withRemoteAddress(InetSocketAddress remoteAddress)
Return a new
ConnectionInfo with the updated remote address. |
ConnectionInfo |
withScheme(String scheme)
Return a new
ConnectionInfo with the updated scheme. |
@Nullable public InetSocketAddress getHostAddress()
@Nullable public InetSocketAddress getRemoteAddress()
public String getScheme()
public ConnectionInfo withHostAddress(InetSocketAddress hostAddress)
ConnectionInfo
with the updated host address.hostAddress
- the host addressConnectionInfo
public ConnectionInfo withHostAddress(InetSocketAddress hostAddress, String hostName, int hostPort)
ConnectionInfo
with updated host address, host name, and host port information.hostAddress
- the updated host addresshostName
- the updated host namehostPort
- the updated host portConnectionInfo
public ConnectionInfo withRemoteAddress(InetSocketAddress remoteAddress)
ConnectionInfo
with the updated remote address.remoteAddress
- the remote addressConnectionInfo
public ConnectionInfo withScheme(String scheme)
ConnectionInfo
with the updated scheme.scheme
- the connection schemeConnectionInfo
public String getHostName()
public int getHostPort()
public static int getDefaultHostPort(String scheme)
scheme
- a connection scheme like "http", "https", or "wss"