Home / Function/ serverResponseHeaderInformational() — netty Function Reference

serverResponseHeaderInformational() — netty Function Reference

Architecture documentation for the serverResponseHeaderInformational() function in InboundHttp2ToHttpAdapterTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0cf34fad_8be8_c52c_87e0_9fecca7d12f7["serverResponseHeaderInformational()"]
  b5bf07b2_a16a_fa49_d2b2_c4bdea19488b["InboundHttp2ToHttpAdapterTest"]
  0cf34fad_8be8_c52c_87e0_9fecca7d12f7 -->|defined in| b5bf07b2_a16a_fa49_d2b2_c4bdea19488b
  ab34dca1_da01_a824_4707_d9e1e8e727ee["boostrapEnv()"]
  0cf34fad_8be8_c52c_87e0_9fecca7d12f7 -->|calls| ab34dca1_da01_a824_4707_d9e1e8e727ee
  87ba315e_fc35_dcbd_e7ab_2b528883bdaa["awaitRequests()"]
  0cf34fad_8be8_c52c_87e0_9fecca7d12f7 -->|calls| 87ba315e_fc35_dcbd_e7ab_2b528883bdaa
  cbd605cc_a17c_ffce_e466_822e222a55ba["awaitResponses()"]
  0cf34fad_8be8_c52c_87e0_9fecca7d12f7 -->|calls| cbd605cc_a17c_ffce_e466_822e222a55ba
  5bb215ee_fce7_494a_e05f_4a2c8c9b9a5b["awaitRequests2()"]
  0cf34fad_8be8_c52c_87e0_9fecca7d12f7 -->|calls| 5bb215ee_fce7_494a_e05f_4a2c8c9b9a5b
  140c2be3_cec7_cecd_3396_1fb2037ae87e["awaitResponses2()"]
  0cf34fad_8be8_c52c_87e0_9fecca7d12f7 -->|calls| 140c2be3_cec7_cecd_3396_1fb2037ae87e
  style 0cf34fad_8be8_c52c_87e0_9fecca7d12f7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http2/src/test/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterTest.java lines 535–631

    @Test
    public void serverResponseHeaderInformational() throws Exception {
        boostrapEnv(1, 2, 1, 2, 1);
        final FullHttpMessage request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.PUT, "/info/test",
                true);
        HttpHeaders httpHeaders = request.headers();
        httpHeaders.setInt(HttpConversionUtil.ExtensionHeaderNames.STREAM_ID.text(), 3);
        httpHeaders.set(HttpHeaderNames.EXPECT, HttpHeaderValues.CONTINUE);
        httpHeaders.setInt(HttpHeaderNames.CONTENT_LENGTH, 0);
        httpHeaders.setShort(HttpConversionUtil.ExtensionHeaderNames.STREAM_WEIGHT.text(), (short) 16);

        final Http2Headers http2Headers = new DefaultHttp2Headers().method(new AsciiString("PUT"))
                .path(new AsciiString("/info/test"))
                .set(new AsciiString(HttpHeaderNames.EXPECT.toString()),
                     new AsciiString(HttpHeaderValues.CONTINUE.toString()));
        final FullHttpMessage response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CONTINUE);
        final String text = "a big payload";
        final ByteBuf payload = Unpooled.copiedBuffer(text.getBytes());
        final FullHttpMessage request2 = request.replace(payload);
        final FullHttpMessage response2 = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);

        try {
            runInChannel(clientChannel, new Http2Runnable() {
                @Override
                public void run() throws Http2Exception {
                    clientHandler.encoder().writeHeaders(ctxClient(), 3, http2Headers, 0, false, newPromiseClient());
                    clientChannel.flush();
                }
            });

            awaitRequests();
            httpHeaders = response.headers();
            httpHeaders.setInt(HttpConversionUtil.ExtensionHeaderNames.STREAM_ID.text(), 3);
            httpHeaders.setInt(HttpHeaderNames.CONTENT_LENGTH, 0);
            final Http2Headers http2HeadersResponse = new DefaultHttp2Headers().status(new AsciiString("100"));
            runInChannel(serverConnectedChannel, new Http2Runnable() {
                @Override
                public void run() throws Http2Exception {
                    serverHandler.encoder().writeHeaders(ctxServer(), 3, http2HeadersResponse, 0, false,
                                                         newPromiseServer());
                    serverConnectedChannel.flush();
                }
            });

            awaitResponses();
            httpHeaders = request2.headers();
            httpHeaders.setInt(HttpHeaderNames.CONTENT_LENGTH, text.length());
            httpHeaders.remove(HttpHeaderNames.EXPECT);
            runInChannel(clientChannel, new Http2Runnable() {
                @Override
                public void run() {
                    clientHandler.encoder().writeData(ctxClient(), 3, payload.retainedDuplicate(), 0, true,
                                                      newPromiseClient());
                    clientChannel.flush();
                }
            });

            awaitRequests2();
            httpHeaders = response2.headers();
            httpHeaders.setInt(HttpConversionUtil.ExtensionHeaderNames.STREAM_ID.text(), 3);
            httpHeaders.setInt(HttpHeaderNames.CONTENT_LENGTH, 0);
            httpHeaders.setShort(HttpConversionUtil.ExtensionHeaderNames.STREAM_WEIGHT.text(), (short) 16);

            final Http2Headers http2HeadersResponse2 = new DefaultHttp2Headers().status(new AsciiString("200"));
            runInChannel(serverConnectedChannel, new Http2Runnable() {
                @Override
                public void run() throws Http2Exception {
                    serverHandler.encoder().writeHeaders(ctxServer(), 3, http2HeadersResponse2, 0, true,
                                                         newPromiseServer());
                    serverConnectedChannel.flush();
                }
            });

            awaitResponses2();
            ArgumentCaptor<FullHttpMessage> requestCaptor = ArgumentCaptor.forClass(FullHttpMessage.class);
            verify(serverListener, times(2)).messageReceived(requestCaptor.capture());
            capturedRequests = requestCaptor.getAllValues();
            assertEquals(2, capturedRequests.size());
            // We do not expect to have this header in the captured request so remove it now.
            assertNotNull(request.headers().remove("x-http2-stream-weight"));

Domain

Subdomains

Frequently Asked Questions

What does serverResponseHeaderInformational() do?
serverResponseHeaderInformational() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterTest.java.
Where is serverResponseHeaderInformational() defined?
serverResponseHeaderInformational() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterTest.java at line 535.
What does serverResponseHeaderInformational() call?
serverResponseHeaderInformational() calls 5 function(s): awaitRequests, awaitRequests2, awaitResponses, awaitResponses2, boostrapEnv.

Analyze Your Own Codebase

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

Try Supermodel Free