Home / Function/ formget() — netty Function Reference

formget() — netty Function Reference

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

Function java Buffer Search called by 1

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java lines 151–200

    private static List<Entry<String, String>> formget(
            Bootstrap bootstrap, String host, int port, String get, URI uriSimple) throws Exception {
        // XXX /formget
        // No use of HttpPostRequestEncoder since not a POST
        Channel channel = bootstrap.connect(host, port).sync().channel();

        // Prepare the HTTP request.
        QueryStringEncoder encoder = new QueryStringEncoder(get);
        // add Form attribute
        encoder.addParam("getform", "GET");
        encoder.addParam("info", "first value");
        encoder.addParam("secondinfo", "secondvalue ���&");
        // not the big one since it is not compatible with GET size
        // encoder.addParam("thirdinfo", textArea);
        encoder.addParam("thirdinfo", "third value\r\ntest second line\r\n\r\nnew line\r\n");
        encoder.addParam("Send", "Send");

        URI uriGet = new URI(encoder.toString());
        HttpRequest request = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, uriGet.toASCIIString());
        HttpHeaders headers = request.headers();
        headers.set(HttpHeaderNames.HOST, host);
        headers.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE);
        headers.set(HttpHeaderNames.ACCEPT_ENCODING, HttpHeaderValues.GZIP + "," + HttpHeaderValues.DEFLATE);

        headers.set(HttpHeaderNames.ACCEPT_CHARSET, "ISO-8859-1,utf-8;q=0.7,*;q=0.7");
        headers.set(HttpHeaderNames.ACCEPT_LANGUAGE, "fr");
        headers.set(HttpHeaderNames.REFERER, uriSimple.toString());
        headers.set(HttpHeaderNames.USER_AGENT, "Netty Simple Http Client side");
        headers.set(HttpHeaderNames.ACCEPT, "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");

        //connection will not close but needed
        // headers.set("Connection","keep-alive");
        // headers.set("Keep-Alive","300");

        headers.set(
                HttpHeaderNames.COOKIE, ClientCookieEncoder.STRICT.encode(
                        new DefaultCookie("my-cookie", "foo"),
                        new DefaultCookie("another-cookie", "bar"))
        );

        // send request
        channel.write(request);
        channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT);

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

        // convert headers to list
        return headers.entries();
    }

Domain

Subdomains

Called By

Frequently Asked Questions

What does formget() do?
formget() is a function in the netty codebase, defined in example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java.
Where is formget() defined?
formget() is defined in example/src/main/java/io/netty/example/http/upload/HttpUploadClient.java at line 151.
What calls formget()?
formget() 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