Home / Function/ sendPreface() — netty Function Reference

sendPreface() — netty Function Reference

Architecture documentation for the sendPreface() function in Http2ConnectionHandler.java from the netty codebase.

Function java Buffer Allocators calls 1 called by 2

Entity Profile

Dependency Diagram

graph TD
  fedde1dc_4baf_9ad9_9fa9_576c4ae34102["sendPreface()"]
  83642a58_aebe_1c6a_ae68_9c2017752662["PrefaceDecoder"]
  fedde1dc_4baf_9ad9_9fa9_576c4ae34102 -->|defined in| 83642a58_aebe_1c6a_ae68_9c2017752662
  73375026_56ea_312c_baa4_40200ab8c7dd["PrefaceDecoder()"]
  73375026_56ea_312c_baa4_40200ab8c7dd -->|calls| fedde1dc_4baf_9ad9_9fa9_576c4ae34102
  f123ca8d_4393_d5af_4aa4_bd6bee27eb0e["channelActive()"]
  f123ca8d_4393_d5af_4aa4_bd6bee27eb0e -->|calls| fedde1dc_4baf_9ad9_9fa9_576c4ae34102
  c32d616e_2a2b_2074_6f4f_9c9367054c5b["write()"]
  fedde1dc_4baf_9ad9_9fa9_576c4ae34102 -->|calls| c32d616e_2a2b_2074_6f4f_9c9367054c5b
  style fedde1dc_4baf_9ad9_9fa9_576c4ae34102 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java lines 370–393

        private void sendPreface(ChannelHandlerContext ctx) throws Exception {
            if (prefaceSent || !ctx.channel().isActive()) {
                return;
            }

            prefaceSent = true;

            final boolean isClient = !connection().isServer();
            if (isClient) {
                // Clients must send the preface string as the first bytes on the connection.
                ctx.write(connectionPrefaceBuf()).addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
            }

            // Both client and server must send their initial settings.
            encoder.writeSettings(ctx, initialSettings, ctx.newPromise()).addListener(
                    ChannelFutureListener.CLOSE_ON_FAILURE);

            if (isClient) {
                // If this handler is extended by the user and we directly fire the userEvent from this context then
                // the user will not see the event. We should fire the event starting with this handler so this class
                // (and extending classes) have a chance to process the event.
                userEventTriggered(ctx, Http2ConnectionPrefaceAndSettingsFrameWrittenEvent.INSTANCE);
            }
        }

Domain

Subdomains

Calls

Frequently Asked Questions

What does sendPreface() do?
sendPreface() is a function in the netty codebase, defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java.
Where is sendPreface() defined?
sendPreface() is defined in codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java at line 370.
What does sendPreface() call?
sendPreface() calls 1 function(s): write.
What calls sendPreface()?
sendPreface() is called by 2 function(s): PrefaceDecoder, channelActive.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free