DebugClientHandler.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:ServiceCOLDCache 作者:
@Override
public void channelRead0(ChannelHandlerContext ctx, HttpObject msg) {
    if (LOGGER.isDebugEnabled()) {
        if (msg instanceof HttpResponse) {
            HttpResponse response = (HttpResponse) msg;
            LOGGER.debug("STATUS: " + response.getStatus());
            LOGGER.debug("VERSION: " + response.getProtocolVersion());
            if (!response.headers().isEmpty()) {
                for (String name : response.headers().names()) {
                    for (String value : response.headers().getAll(name)) {
                        LOGGER.debug("HEADER: " + name + " = " + value);
                    }
                }
            }
            if (HttpHeaders.isTransferEncodingChunked(response)) {
                LOGGER.debug("CHUNKED CONTENT {");
            } else {
                LOGGER.debug("CONTENT {");
            }
        }
        if (msg instanceof HttpContent) {
            HttpContent content = (HttpContent) msg;
            LOGGER.debug(content.content().toString(CharsetUtil.UTF_8));
            if (content instanceof LastHttpContent) {
                LOGGER.debug("} END OF CONTENT");
            }
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号