public interface NettyServerCustomizer
NettyServerCustomizer.Registry
, and live while the server is running. Customizers with
narrower scope are created from the root customizers through
specialization
when new netty channels are created by the
server, e.g. when a client connects. These specialized customizers will then receive
notifications when a certain step in the pipeline setup is reached, so they can do their own
customizations on the channel and the channel pipeline they received in the specialization step.Modifier and Type | Interface and Description |
---|---|
static class |
NettyServerCustomizer.ChannelRole
Enum to describe the role of the channel passed to
specializeForChannel(Channel, ChannelRole) . |
static interface |
NettyServerCustomizer.Registry
Interface implemented by the HTTP server to register customizers.
|
Modifier and Type | Method and Description |
---|---|
default void |
onInitialPipelineBuilt()
Called when the initial connection pipeline has been built, before any incoming data
has been processed.
|
default void |
onStreamPipelineBuilt()
Called when the "final" stream pipeline has been built for processing http requests.
|
default NettyServerCustomizer |
specializeForChannel(io.netty.channel.Channel channel,
NettyServerCustomizer.ChannelRole role)
Specialize this customizer for the given channel.
|
@NonNull default NettyServerCustomizer specializeForChannel(@NonNull io.netty.channel.Channel channel, @NonNull NettyServerCustomizer.ChannelRole role)
ServerSocketChannel
when the
server binds to a configured TCP port, and then to a
SocketChannel
when a client connects to that port.
ServerDomainSocketChannel
and
DomainSocketChannel
respectively). In the case of an
EmbeddedChannel
used for testing, there might not be a
listener channel at all. For HTTP/2, each HTTP stream may get its own channel that is
specialized from the overall connection channel. And finally, HTTP/3 support has to use
datagram channels instead of the socket-based ones.channel
- The new channel to specialize for.role
- The role (or scope) of the channel.this
if no specialization needs to take place.default void onInitialPipelineBuilt()
default void onStreamPipelineBuilt()
onInitialPipelineBuilt()
. For TLS-based HTTP/2
support, where HTTP/1 or HTTP/2 is negotiated through TLS ALPN, this will be called when
negotiation is complete. However for HTTP/2 specifically, this may be changed in the future
when we switch to netty channel multiplexing, where each HTTP/2 stream gets its own channel.