Home / Class/ HttpUploadClientHandler Class — netty Architecture

HttpUploadClientHandler Class — netty Architecture

Architecture documentation for the HttpUploadClientHandler class in HttpUploadClientHandler.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e4fa85df_a638_b076_44db_9526fb6537c5["HttpUploadClientHandler"]
  2d29b93a_2501_1057_26c7_715de2ac5bf2["HttpUploadClientHandler.java"]
  e4fa85df_a638_b076_44db_9526fb6537c5 -->|defined in| 2d29b93a_2501_1057_26c7_715de2ac5bf2
  04bbefde_29f0_e956_9653_f281646ba84c["channelRead0()"]
  e4fa85df_a638_b076_44db_9526fb6537c5 -->|method| 04bbefde_29f0_e956_9653_f281646ba84c
  0eb88a8e_56e3_1993_2371_dbf0d45c1d5a["exceptionCaught()"]
  e4fa85df_a638_b076_44db_9526fb6537c5 -->|method| 0eb88a8e_56e3_1993_2371_dbf0d45c1d5a

Relationship Graph

Source Code

example/src/main/java/io/netty/example/http/upload/HttpUploadClientHandler.java lines 30–79

public class HttpUploadClientHandler extends SimpleChannelInboundHandler<HttpObject> {

    private boolean readingChunks;

    @Override
    public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) {
        if (msg instanceof HttpResponse) {
            HttpResponse response = (HttpResponse) msg;

            System.err.println("STATUS: " + response.status());
            System.err.println("VERSION: " + response.protocolVersion());

            if (!response.headers().isEmpty()) {
                for (CharSequence name : response.headers().names()) {
                    for (CharSequence value : response.headers().getAll(name)) {
                        System.err.println("HEADER: " + name + " = " + value);
                    }
                }
            }

            if (response.status().code() == 200 && HttpUtil.isTransferEncodingChunked(response)) {
                readingChunks = true;
                System.err.println("CHUNKED CONTENT {");
            } else {
                System.err.println("CONTENT {");
            }
        }
        if (msg instanceof HttpContent) {
            HttpContent chunk = (HttpContent) msg;
            System.err.println(chunk.content().toString(CharsetUtil.UTF_8));

            if (chunk instanceof LastHttpContent) {
                if (readingChunks) {
                    System.err.println("} END OF CHUNKED CONTENT");
                } else {
                    System.err.println("} END OF CONTENT");
                }
                readingChunks = false;
            } else {
                System.err.println(chunk.content().toString(CharsetUtil.UTF_8));
            }
        }
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        cause.printStackTrace();
        ctx.channel().close();
    }
}

Frequently Asked Questions

What is the HttpUploadClientHandler class?
HttpUploadClientHandler is a class in the netty codebase, defined in example/src/main/java/io/netty/example/http/upload/HttpUploadClientHandler.java.
Where is HttpUploadClientHandler defined?
HttpUploadClientHandler is defined in example/src/main/java/io/netty/example/http/upload/HttpUploadClientHandler.java at line 30.

Analyze Your Own Codebase

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

Try Supermodel Free