Home / Function/ formpostmultipart() — netty Function Reference

formpostmultipart() — netty Function Reference

Architecture documentation for the formpostmultipart() function in HttpUploadClient.java from the netty codebase.

Function java Buffer Search calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  d9705f9a_6272_0aa0_3cd7_4bfaf6636ab5["formpostmultipart()"]
  b9da3ba5_7453_22c6_2d8f_69c79b4ca314["HttpUploadClient"]
  d9705f9a_6272_0aa0_3cd7_4bfaf6636ab5 -->|defined in| b9da3ba5_7453_22c6_2d8f_69c79b4ca314
  9eb10f57_11e0_77d4_dfe6_470ff611d081["main()"]
  9eb10f57_11e0_77d4_dfe6_470ff611d081 -->|calls| d9705f9a_6272_0aa0_3cd7_4bfaf6636ab5
  74523085_3ff4_6038_bdc0_b90d4585970b["formpost()"]
  d9705f9a_6272_0aa0_3cd7_4bfaf6636ab5 -->|calls| 74523085_3ff4_6038_bdc0_b90d4585970b
  style d9705f9a_6272_0aa0_3cd7_4bfaf6636ab5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java lines 268–309

    private static void formpostmultipart(
            Bootstrap bootstrap, String host, int port, URI uriFile, HttpDataFactory factory,
            Iterable<Entry<String, String>> headers, List<InterfaceHttpData> bodylist) throws Exception {
        // XXX /formpostmultipart
        // Start the connection attempt.
        ChannelFuture future = bootstrap.connect(SocketUtils.socketAddress(host, port));
        // Wait until the connection attempt succeeds or fails.
        Channel channel = future.sync().channel();

        // Prepare the HTTP request.
        HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, uriFile.toASCIIString());

        // Use the PostBody encoder
        HttpPostRequestEncoder bodyRequestEncoder =
                new HttpPostRequestEncoder(factory, request, true); // true => multipart

        // it is legal to add directly header or cookie into the request until finalize
        for (Entry<String, String> entry : headers) {
            request.headers().set(entry.getKey(), entry.getValue());
        }

        // add Form attribute from previous request in formpost()
        bodyRequestEncoder.setBodyHttpDatas(bodylist);

        // finalize request
        bodyRequestEncoder.finalizeRequest();

        // send request
        channel.write(request);

        // test if request was chunked and if so, finish the write
        if (bodyRequestEncoder.isChunked()) {
            channel.write(bodyRequestEncoder);
        }
        channel.flush();

        // Now no more use of file representation (and list of HttpData)
        bodyRequestEncoder.cleanFiles();

        // Wait for the server to close the connection.
        channel.closeFuture().sync();
    }

Domain

Subdomains

Calls

Called By

Frequently Asked Questions

What does formpostmultipart() do?
formpostmultipart() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java.
Where is formpostmultipart() defined?
formpostmultipart() is defined in example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java at line 268.
What does formpostmultipart() call?
formpostmultipart() calls 1 function(s): formpost.
What calls formpostmultipart()?
formpostmultipart() is called by 1 function(s): main.

Analyze Your Own Codebase

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

Try Supermodel Free