Home / Function/ testDecodeContentDispositionFieldParameters() — netty Function Reference

testDecodeContentDispositionFieldParameters() — netty Function Reference

Architecture documentation for the testDecodeContentDispositionFieldParameters() function in HttpPostRequestDecoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  eaeae0da_dc4a_989d_46a5_0d400ef92f93["testDecodeContentDispositionFieldParameters()"]
  d3dadcbe_07b1_86dc_3f34_5a56e9d1367e["HttpPostRequestDecoderTest"]
  eaeae0da_dc4a_989d_46a5_0d400ef92f93 -->|defined in| d3dadcbe_07b1_86dc_3f34_5a56e9d1367e
  style eaeae0da_dc4a_989d_46a5_0d400ef92f93 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoderTest.java lines 566–597

    @Test
    public void testDecodeContentDispositionFieldParameters() throws Exception {

        final String boundary = "74e78d11b0214bdcbc2f86491eeb4902";

        String encoding = "utf-8";
        String filename = "attached_файл.txt";
        String filenameEncoded = URLEncoder.encode(filename, encoding);

        final String body = "--" + boundary + "\r\n" +
                "Content-Disposition: form-data; name=\"file\"; filename*=" + encoding + "''" + filenameEncoded +
                "\r\n\r\n" +
                "foo\r\n" +
                "\r\n" +
                "--" + boundary + "--";

        final DefaultFullHttpRequest req = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1,
                HttpMethod.POST,
                "http://localhost",
                Unpooled.wrappedBuffer(body.getBytes()));

        req.headers().add(HttpHeaderNames.CONTENT_TYPE, "multipart/form-data; boundary=" + boundary);
        final DefaultHttpDataFactory inMemoryFactory = new DefaultHttpDataFactory(false);
        final HttpPostRequestDecoder decoder = new HttpPostRequestDecoder(inMemoryFactory, req);
        assertFalse(decoder.getBodyHttpDatas().isEmpty());
        InterfaceHttpData part1 = decoder.getBodyHttpDatas().get(0);
        assertTrue(part1 instanceof FileUpload, "the item should be a FileUpload");
        FileUpload fileUpload = (FileUpload) part1;
        assertEquals(filename, fileUpload.getFilename(), "the filename should be decoded");
        decoder.destroy();
        assertTrue(req.release());
    }

Domain

Subdomains

Frequently Asked Questions

What does testDecodeContentDispositionFieldParameters() do?
testDecodeContentDispositionFieldParameters() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoderTest.java.
Where is testDecodeContentDispositionFieldParameters() defined?
testDecodeContentDispositionFieldParameters() is defined in codec-http/src/test/java/io/netty/handler/codec/http/multipart/HttpPostRequestDecoderTest.java at line 566.

Analyze Your Own Codebase

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

Try Supermodel Free