Top Description Fields Constructors Methods
reactor.netty5.http.server

public final Class ConnectionInfo

extends Object
Class Inheritance
Imports
java.net.InetSocketAddress, .SocketAddress, java.util.function.BiFunction, io.netty5.channel.Channel, io.netty5.channel.socket.SocketChannel, io.netty5.handler.codec.http.HttpRequest, reactor.util.annotation.Nullable

Resolve information about the current connection, including the host (server) address, the remote (client) address and the scheme.

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.

Authors
Brian Clozel, Andrey Shlykov
Since
0.8
See Also
rfc7239

Field Summary

Modifier and TypeField and Description
pack-priv final InetSocketAddress
pack-priv final InetSocketAddress
pack-priv final String

Constructor Summary

AccessConstructor and Description
pack-priv
ConnectionInfo(InetSocketAddress hostAddress, InetSocketAddress remoteAddress, String scheme)

Method Summary

Modifier and TypeMethod and Description
pack-priv static ConnectionInfo
from(Channel channel, HttpRequest request, boolean secured, SocketAddress remoteAddress, BiFunction<ConnectionInfo, HttpRequest, ConnectionInfo> forwardedHeaderHandler)

public InetSocketAddress

Returns:

the host address
getHostAddress
()

Return the host address of the connection.

public InetSocketAddress

Returns:

the remote address
getRemoteAddress
()

Return the remote address of the connection.

public String

Returns:

the connection scheme
getScheme
()

Return the connection scheme.

pack-priv static ConnectionInfo

Returns:

the connection information
newConnectionInfo
(Channel
the current channel
c
,
boolean
is transport secure (SSL)
secured
,
InetSocketAddress remoteAddress)

Retrieve the connection information from the current connection directly

public ConnectionInfo

Returns:

a new ConnectionInfo
withHostAddress
(InetSocketAddress
the host address
hostAddress
)

Return a new ConnectionInfo with the updated host address.

public ConnectionInfo

Returns:

a new ConnectionInfo
withRemoteAddress
(InetSocketAddress
the remote address
remoteAddress
)

Return a new ConnectionInfo with the updated remote address.

public ConnectionInfo

Returns:

a new ConnectionInfo
withScheme
(String
the connection scheme
scheme
)

Return a new ConnectionInfo with the updated scheme.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

hostAddressback to summary
pack-priv final InetSocketAddress hostAddress
remoteAddressback to summary
pack-priv final InetSocketAddress remoteAddress
schemeback to summary
pack-priv final String scheme

Constructor Detail

ConnectionInfoback to summary
pack-priv ConnectionInfo(InetSocketAddress hostAddress, InetSocketAddress remoteAddress, String scheme)

Method Detail

fromback to summary
pack-priv static ConnectionInfo from(Channel channel, HttpRequest request, boolean secured, SocketAddress remoteAddress, BiFunction<ConnectionInfo, HttpRequest, ConnectionInfo> forwardedHeaderHandler)
Annotations
@Nullable
getHostAddressback to summary
public InetSocketAddress getHostAddress()

Return the host address of the connection.

Returns:InetSocketAddress

the host address

getRemoteAddressback to summary
public InetSocketAddress getRemoteAddress()

Return the remote address of the connection.

Returns:InetSocketAddress

the remote address

getSchemeback to summary
public String getScheme()

Return the connection scheme.

Returns:String

the connection scheme

newConnectionInfoback to summary
pack-priv static ConnectionInfo newConnectionInfo(Channel c, boolean secured, InetSocketAddress remoteAddress)

Retrieve the connection information from the current connection directly

Parameters
c:Channel

the current channel

secured:boolean

is transport secure (SSL)

Returns:ConnectionInfo

the connection information

withHostAddressback to summary
public ConnectionInfo withHostAddress(InetSocketAddress hostAddress)

Return a new ConnectionInfo with the updated host address.

Parameters
hostAddress:InetSocketAddress

the host address

Returns:ConnectionInfo

a new ConnectionInfo

withRemoteAddressback to summary
public ConnectionInfo withRemoteAddress(InetSocketAddress remoteAddress)

Return a new ConnectionInfo with the updated remote address.

Parameters
remoteAddress:InetSocketAddress

the remote address

Returns:ConnectionInfo

a new ConnectionInfo

withSchemeback to summary
public ConnectionInfo withScheme(String scheme)

Return a new ConnectionInfo with the updated scheme.

Parameters
scheme:String

the connection scheme

Returns:ConnectionInfo

a new ConnectionInfo