HttpSnoopClientHandler Class — netty Architecture
Architecture documentation for the HttpSnoopClientHandler class in HttpSnoopClientHandler.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD c0846785_201f_c2a0_0a21_3b7cd7542904["HttpSnoopClientHandler"] aeeab488_7444_a287_81b6_c7ecc8cdb149["HttpSnoopClientHandler.java"] c0846785_201f_c2a0_0a21_3b7cd7542904 -->|defined in| aeeab488_7444_a287_81b6_c7ecc8cdb149 45865a5f_ca2e_a5fe_d32a_8c87627889ba["channelRead0()"] c0846785_201f_c2a0_0a21_3b7cd7542904 -->|method| 45865a5f_ca2e_a5fe_d32a_8c87627889ba 42a69beb_5834_ff54_9d07_bfb744ddb660["exceptionCaught()"] c0846785_201f_c2a0_0a21_3b7cd7542904 -->|method| 42a69beb_5834_ff54_9d07_bfb744ddb660
Relationship Graph
Source Code
example/src/main/java/io/netty/example/http/snoop/HttpSnoopClientHandler.java lines 27–71
public class HttpSnoopClientHandler extends SimpleChannelInboundHandler<HttpObject> {
@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());
System.err.println();
if (!response.headers().isEmpty()) {
for (CharSequence name: response.headers().names()) {
for (CharSequence value: response.headers().getAll(name)) {
System.err.println("HEADER: " + name + " = " + value);
}
}
System.err.println();
}
if (HttpUtil.isTransferEncodingChunked(response)) {
System.err.println("CHUNKED CONTENT {");
} else {
System.err.println("CONTENT {");
}
}
if (msg instanceof HttpContent) {
HttpContent content = (HttpContent) msg;
System.err.print(content.content().toString(CharsetUtil.UTF_8));
System.err.flush();
if (content instanceof LastHttpContent) {
System.err.println("} END OF CONTENT");
ctx.close();
}
}
}
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
cause.printStackTrace();
ctx.close();
}
}
Source
Frequently Asked Questions
What is the HttpSnoopClientHandler class?
HttpSnoopClientHandler is a class in the netty codebase, defined in example/src/main/java/io/netty/example/http/snoop/HttpSnoopClientHandler.java.
Where is HttpSnoopClientHandler defined?
HttpSnoopClientHandler is defined in example/src/main/java/io/netty/example/http/snoop/HttpSnoopClientHandler.java at line 27.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free