Home / Function/ testHttpPostRequestEncoderSlicedBuffer() — netty Function Reference

testHttpPostRequestEncoderSlicedBuffer() — netty Function Reference

Architecture documentation for the testHttpPostRequestEncoderSlicedBuffer() function in HttpPostRequestEncoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  415162c1_ebed_04b9_6c61_29f80f31b452["testHttpPostRequestEncoderSlicedBuffer()"]
  3af766b2_b7f3_8257_aeb8_621a4404fee6["HttpPostRequestEncoderTest"]
  415162c1_ebed_04b9_6c61_29f80f31b452 -->|defined in| 3af766b2_b7f3_8257_aeb8_621a4404fee6
  d7054625_795e_5277_1f1f_37aeb40c353b["String()"]
  415162c1_ebed_04b9_6c61_29f80f31b452 -->|calls| d7054625_795e_5277_1f1f_37aeb40c353b
  style 415162c1_ebed_04b9_6c61_29f80f31b452 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoderTest.java lines 332–362

    @Test
    public void testHttpPostRequestEncoderSlicedBuffer() throws Exception {
        DefaultFullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
                HttpMethod.POST, "http://localhost");

        HttpPostRequestEncoder encoder = new HttpPostRequestEncoder(request, true);
        // add Form attribute
        encoder.addBodyAttribute("getform", "POST");
        encoder.addBodyAttribute("info", "first value");
        encoder.addBodyAttribute("secondinfo", "secondvalue a&");
        encoder.addBodyAttribute("thirdinfo", "short text");
        int length = 100000;
        char[] array = new char[length];
        Arrays.fill(array, 'a');
        String longText = new String(array);
        encoder.addBodyAttribute("fourthinfo", longText.substring(0, 7470));
        File file1 = new File(getClass().getResource("/file-01.txt").toURI());
        encoder.addBodyFileUpload("myfile", file1, "application/x-zip-compressed", false);
        encoder.finalizeRequest();
        while (! encoder.isEndOfInput()) {
            HttpContent httpContent = encoder.readChunk((ByteBufAllocator) null);
            ByteBuf content = httpContent.content();
            int refCnt = content.refCnt();
            assertTrue((content.unwrap() == content || content.unwrap() == null) && refCnt == 1 ||
                    content.unwrap() != content && refCnt == 2,
                    "content: " + content + " content.unwrap(): " + content.unwrap() + " refCnt: " + refCnt);
            httpContent.release();
        }
        encoder.cleanFiles();
        encoder.close();
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does testHttpPostRequestEncoderSlicedBuffer() do?
testHttpPostRequestEncoderSlicedBuffer() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoderTest.java.
Where is testHttpPostRequestEncoderSlicedBuffer() defined?
testHttpPostRequestEncoderSlicedBuffer() is defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoderTest.java at line 332.
What does testHttpPostRequestEncoderSlicedBuffer() call?
testHttpPostRequestEncoderSlicedBuffer() calls 1 function(s): String.

Analyze Your Own Codebase

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

Try Supermodel Free