Netty4.0学习笔记系列之三:构建简单的http服务

Netty4.0学习笔记系列之三:构建简单的http服务

(2014-05-13 16:59:12)
var tag=netty,it;var tag_code='0c7d37010b2b1948f445b1df9bccd5e3'; var rquotebligid=5c0522dd0101e262;var worldcup='0'; var $worldcupball='0'; 标签:

netty

it

分类: Java
http://blog.csdn.net/u013252773/article/details/21254257

本文主要介绍如何通过Netty构建一个简单的http服务。

想要实现的目的是:

1、Client向Server发送http请求。

2、Server端对http请求进行解析。

3、Server端向client发送http响应。

4、Client对http响应进行解析。

在该实例中,会涉及到http请求的编码、解码,http响应的编码、解码,幸运的是,Netty已经为我们提供了这些工具,整个实例的逻辑图如下所示:


其中红色框中的4个类是Netty提供的,它们其实也是一种Handler,其中Encoder继承自ChannelOutboundHandler,Decoder继承自ChannelInboundHandler,它们的作用是:

1、HttpRequestEncoder:对httpRequest进行编码。

2、HttpRequestDecoder:把流数据解析为httpRequest。

3、HttpResponsetEncoder:对httpResponset进行编码。

4、HttpResponseEncoder:把流数据解析为httpResponse。

该实例涉及到的类有5个:HttpServer HttpServerInboundHandler HttpClient HttpClientInboundHandler ByteBufToBytes

1、HttpServer 启动http服务器

 

[java]  view plain copy 在CODE上查看代码片 派生到我的代码片


  1. package com.guowl.testhttpprotocol;  
  2.   
  3. import io.netty.bootstrap.ServerBootstrap;  
  4. import io.netty.channel.ChannelFuture;  
  5. import io.netty.channel.ChannelInitializer;  
  6. import io.netty.channel.ChannelOption;  
  7. import io.netty.channel.EventLoopGroup;  
  8. import io.netty.channel.nio.NioEventLoopGroup;  
  9. import io.netty.channel.socket.SocketChannel;  
  10. import io.netty.channel.socket.nio.NioServerSocketChannel;  
  11. import io.netty.handler.codec.http.HttpRequestDecoder;  
  12. import io.netty.handler.codec.http.HttpResponseEncoder;  
  13.   
  14. public class HttpServer  
  15.     public void start(int port) throws Exception  
  16.         EventLoopGroup bossGroup new NioEventLoopGroup(); // (1)  
  17.         EventLoopGroup workerGroup new NioEventLoopGroup();  
  18.         try  
  19.             ServerBootstrap new ServerBootstrap(); // (2)  
  20.             b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) // (3)  
  21.                     .childHandler(new ChannelInitializer() // (4)  
  22.                                 @Override  
  23.                                 public void initChannel(SocketChannel ch) throws Exception  
  24.                                     // server端发送的是httpResponse,所以要使用HttpResponseEncoder进行编码  
  25.                                     ch.pipeline().addLast(new HttpResponseEncoder());  
  26.                                     // server端接收到的是httpRequest,所以要使用HttpRequestDecoder进行解码  
  27.                                     ch.pipeline().addLast(new HttpRequestDecoder());  
  28.                                     ch.pipeline().addLast(new HttpServerInboundHandler());  
  29.                                  
  30.                             }).option(ChannelOption.SO_BACKLOG, 128) // (5)  
  31.                     .childOption(ChannelOption.SO_KEEPALIVE, true); // (6)  
  32.   
  33.             ChannelFuture b.bind(port).sync(); // (7)  
  34.   
  35.             f.channel().closeFuture().sync();  
  36.         finally  
  37.             workerGroup.shutdownGracefully();  
  38.             bossGroup.shutdownGracefully();  
  39.          
  40.      
  41.   
  42.     public static void main(String[] args) throws Exception  
  43.         HttpServer server new HttpServer();  
  44.         server.start(8000);  
  45.      
  46.  

2、HttpServerInboundHandler 解析客户端的请求,并进行响应

 

[java]  view plain copy 在CODE上查看代码片 派生到我的代码片


  1. package com.guowl.testhttpprotocol;  
  2.   
  3. import static io.netty.handler.codec.http.HttpHeaders.Names.CONNECTION;  
  4. import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_LENGTH;  
  5. import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE;  
  6. import static io.netty.handler.codec.http.HttpResponseStatus.OK;  
  7. import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1;  
  8. import io.netty.buffer.ByteBuf;  
  9. import io.netty.buffer.Unpooled;  
  10. import io.netty.channel.ChannelHandlerContext;  
  11. import io.netty.channel.ChannelInboundHandlerAdapter;  
  12. import io.netty.handler.codec.http.DefaultFullHttpResponse;  
  13. import io.netty.handler.codec.http.FullHttpResponse;  
  14. import io.netty.handler.codec.http.HttpContent;  
  15. import io.netty.handler.codec.http.HttpHeaders;  
  16. import io.netty.handler.codec.http.HttpHeaders.Values;  
  17. import io.netty.handler.codec.http.HttpRequest;  
  18.   
  19. import org.slf4j.Logger;  
  20. import org.slf4j.LoggerFactory;  
  21.   
  22. import com.guowl.utils.ByteBufToBytes;  
  23.   
  24. public class HttpServerInboundHandler extends ChannelInboundHandlerAdapter  
  25.     private static Logger   logger  LoggerFactory.getLogger(HttpServerInboundHandler.class);  
  26.     private ByteBufToBytes reader;  
  27.   
  28.     @Override  
  29.     public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception  
  30.         if (msg instanceof HttpRequest)  
  31.             HttpRequest request (HttpRequest) msg;  
  32.             System.out.println(”messageType:” request.headers().get(“messageType”));  
  33.             System.out.println(”businessType:” request.headers().get(“businessType”));  
  34.             if (HttpHeaders.isContentLengthSet(request))  
  35.                 reader new ByteBufToBytes((int) HttpHeaders.getContentLength(request));  
  36.              
  37.          
  38.   
  39.         if (msg instanceof HttpContent)  
  40.             HttpContent httpContent (HttpContent) msg;  
  41.             ByteBuf content httpContent.content();  
  42.             reader.reading(content);  
  43.             content.release();  
  44.   
  45.             if (reader.isEnd())  
  46.                 String resultStr new String(reader.readFull());  
  47.                 System.out.println(”Client said:” resultStr);  
  48.   
  49.                 FullHttpResponse response new DefaultFullHttpResponse(HTTP_1_1, OK, Unpooled.wrappedBuffer(“I am ok”  
  50.                         .getBytes()));  
  51.                 response.headers().set(CONTENT_TYPE, ”text/plain”);  
  52.                 response.headers().set(CONTENT_LENGTH, response.content().readableBytes());  
  53.                 response.headers().set(CONNECTION, Values.KEEP_ALIVE);  
  54.                 ctx.write(response);  
  55.                 ctx.flush();  
  56.              
  57.          
  58.      
  59.   
  60.     @Override  
  61.     public void channelReadComplete(ChannelHandlerContext ctx) throws Exception  
  62.         logger.info(”HttpServerInboundHandler.channelReadComplete”);  
  63.         ctx.flush();  
  64.      
  65.   
  66.  

3、HttpClient 向服务器发送请求

 

[java]  view plain copy 在CODE上查看代码片 派生到我的代码片


  1. package com.guowl.testhttpprotocol;  
  2.   
  3. import io.netty.bootstrap.Bootstrap;  
  4. import io.netty.buffer.Unpooled;  
  5. import io.netty.channel.ChannelFuture;  
  6. import io.netty.channel.ChannelInitializer;  
  7. import io.netty.channel.ChannelOption;  
  8. import io.netty.channel.EventLoopGroup;  
  9. import io.netty.channel.nio.NioEventLoopGroup;  
  10. import io.netty.channel.socket.SocketChannel;  
  11. import io.netty.channel.socket.nio.NioSocketChannel;  
  12. import io.netty.handler.codec.http.DefaultFullHttpRequest;  
  13. import io.netty.handler.codec.http.HttpHeaders;  
  14. import io.netty.handler.codec.http.HttpMethod;  
  15. import io.netty.handler.codec.http.HttpRequestEncoder;  
  16. import io.netty.handler.codec.http.HttpResponseDecoder;  
  17. import io.netty.handler.codec.http.HttpVersion;  
  18.   
  19. import java.net.URI;  
  20.   
  21. public class HttpClient  
  22.     public void connect(String host, int port) throws Exception  
  23.         EventLoopGroup workerGroup new NioEventLoopGroup();  
  24.   
  25.         try  
  26.             Bootstrap new Bootstrap(); // (1)  
  27.             b.group(workerGroup); // (2)  
  28.             b.channel(NioSocketChannel.class); // (3)  
  29.             b.option(ChannelOption.SO_KEEPALIVE, true); // (4)  
  30.             b.handler(new ChannelInitializer()  
  31.                 @Override  
  32.                 public void initChannel(SocketChannel ch) throws Exception  
  33.                     // 客户端接收到的是httpResponse响应,所以要使用HttpResponseDecoder进行解码  
  34.                     ch.pipeline().addLast(new HttpResponseDecoder());  
  35.                     // 客户端发送的是httprequest,所以要使用HttpRequestEncoder进行编码  
  36.                     ch.pipeline().addLast(new HttpRequestEncoder());  
  37.                     ch.pipeline().addLast(new HttpClientInboundHandler());  
  38.                  
  39.             });  
  40.   
  41.             // Start the client.  
  42.             ChannelFuture b.connect(host, port).sync(); // (5)  
  43.   
  44.             URI uri new URI(“http://127.0.0.1:8000”);  
  45.             String msg ”Are you ok?”;  
  46.             DefaultFullHttpRequest request new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST,  
  47.                     uri.toASCIIString(), Unpooled.wrappedBuffer(msg.getBytes()));  
  48.   
  49.             // 构建http请求  
  50.             request.headers().set(HttpHeaders.Names.HOST, host);  
  51.             request.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);  
  52.             request.headers().set(HttpHeaders.Names.CONTENT_LENGTH, request.content().readableBytes());  
  53.             request.headers().set(”messageType”, “normal”);  
  54.             request.headers().set(”businessType”, “testServerState”);  
  55.             // 发送http请求  
  56.             f.channel().write(request);  
  57.             f.channel().flush();  
  58.             f.channel().closeFuture().sync();  
  59.         finally  
  60.             workerGroup.shutdownGracefully();  
  61.          
  62.   
  63.      
  64.   
  65.     public static void main(String[] args) throws Exception  
  66.         HttpClient client new HttpClient();  
  67.         client.connect(”127.0.0.1”, 8000);  
  68.      
  69.  


4、HttpClientInboundHandler
对服务器的响应进行读取

 

 

[java]  view plain copy 在CODE上查看代码片 派生到我的代码片


  1. package com.guowl.testhttpprotocol;  
  2.   
  3. import io.netty.buffer.ByteBuf;  
  4. import io.netty.channel.ChannelHandlerContext;  
  5. import io.netty.channel.ChannelInboundHandlerAdapter;  
  6. import io.netty.handler.codec.http.HttpContent;  
  7. import io.netty.handler.codec.http.HttpHeaders;  
  8. import io.netty.handler.codec.http.HttpResponse;  
  9.   
  10. import com.guowl.utils.ByteBufToBytes;  
  11.   
  12. public class HttpClientInboundHandler extends ChannelInboundHandlerAdapter  
  13.     private ByteBufToBytes reader;  
  14.   
  15.     @Override  
  16.     public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception  
  17.         if (msg instanceof HttpResponse)  
  18.             HttpResponse response (HttpResponse) msg;  
  19.             System.out.println(”CONTENT_TYPE:” response.headers().get(HttpHeaders.Names.CONTENT_TYPE));  
  20.             if (HttpHeaders.isContentLengthSet(response))  
  21.                 reader new ByteBufToBytes((int) HttpHeaders.getContentLength(response));  
  22.              
  23.          
  24.   
  25.         if (msg instanceof HttpContent)  
  26.             HttpContent httpContent (HttpContent) msg;  
  27.             ByteBuf content httpContent.content();  
  28.             reader.reading(content);  
  29.             content.release();  
  30.   
  31.             if (reader.isEnd())  
  32.                 String resultStr new String(reader.readFull());  
  33.                 System.out.println(”Server said:” resultStr);  
  34.                   
  35.                 ctx.close();  
  36.              
  37.          
  38.      
  39.   
  40.  

5、ByteBufToBytes 读取NIO的工具类,可以一次性把ByteBuf的数据读取出来,也可以把多次ByteBuf中的数据统一读取出来。

 

[java]  view plain copy 在CODE上查看代码片 派生到我的代码片


  1. package com.guowl.utils;  
  2.   
  3. import io.netty.buffer.ByteBuf;  
  4. import io.netty.buffer.Unpooled;  
  5.   
  6. public class ByteBufToBytes  
  7.     private ByteBuf temp;  
  8.   
  9.     private boolean end true;  
  10.   
  11.     public ByteBufToBytes(int length)  
  12.         temp Unpooled.buffer(length);  
  13.      
  14.   
  15.     public void reading(ByteBuf datas)  
  16.         datas.readBytes(temp, datas.readableBytes());  
  17.         if (this.temp.writableBytes() != 0)  
  18.             end false;  
  19.         else  
  20.             end true;  
  21.          
  22.      
  23.   
  24.     public boolean isEnd()  
  25.         return end;  
  26.      
  27.   
  28.     public byte[] readFull()  
  29.         if (end)  
  30.             byte[] contentByte new byte[this.temp.readableBytes()];  
  31.             this.temp.readBytes(contentByte);  
  32.             this.temp.release();  
  33.             return contentByte;  
  34.         else  
  35.             return null;  
  36.          
  37.      
  38.   
  39.     public byte[] read(ByteBuf datas)  
  40.         byte[] bytes new byte[datas.readableBytes()];  
  41.         datas.readBytes(bytes);  
  42.         return bytes;  
  43.      
  44.  


注意事项:

 

 

1、可以通过在Netty的Chanel中发送HttpRequest对象,完成发送http请求的要求,同时可以对HttpHeader进行设置。

2、可以通过HttpResponse发送http响应,同时可以对HttpHeader进行设置。

3、上面涉及到的http对象都是Netty自己封装的,不是标准的。








19






1



        </div>
        <div class="clearit"></div>
    </div>
    <div class="articalInfo">
        <!-- 分享到微博 {$t_blog} -->
        <div class="IL">
            阅读<span id="r_5c0522dd0101e262" class="SG_txtb">(6679)</span><em class="SG_txtb">┊</em> 
            <a href="#commonComment">评论</a> <span id="c_5c0522dd0101e262" class="SG_txtb">(0)</span><em class="SG_txtb">┊</em>              <a href="javascript:;" onclick="$articleManage('5c0522dd0101e262',5);return false;">收藏</a><span id="f_5c0522dd0101e262" class="SG_txtb">(0)</span>
            <em class="SG_txtb">┊</em><a href="#" id="quote_set_sign" onclick="return false ;">转载</a><a href="#" id="z_5c0522dd0101e262" onclick="return false ;" class="zznum">(2)</a>             <span id="fn_Netty4.0学习笔记系列之三:构建简单的http服务" class="SG_txtb"></span><em class="SG_txtb">┊</em>
            <a onclick="return false;" href="javascript:;"><cite id="d1_digg_5c0522dd0101e262">喜欢</cite></a><a id="d1_digg_down_5c0522dd0101e262" href="javascript:;"><b>▼</b></a>
                                <em class="SG_txtb">┊</em><a href="http://blog.sina.com.cn/main_v5/ria/print.html?blog_id=blog_5c0522dd0101e262" target="_blank">打印</a><em class="SG_txtb">┊</em><a id="q_5c0522dd0101e262" onclick="report('5c0522dd0101e262');return false;" href="#">举报</a>
                                        </div>
        <div class="IR">
            <table>
                <tbody><tr>
                                        <th class="SG_txtb" scope="row">已投稿到:</th>
                    <td>
                        <div class="IR_list">
                            <span><img class="SG_icon SG_icon36" src="http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif" title="排行榜" width="15" height="15" align="absmiddle"> <a href="http://blog.sina.com.cn/lm/114/113/day.html" class="SG_linkb" target="_blank">排行榜</a></span>                          </div>
                    </td>
                                    </tr>
                                </tbody></table>
        </div>
    </div>
    <div class="clearit"></div>
    <div class="blogzz_zzlist borderc" id="blog_quote" style="display:none"><h3><a href="#" onclick="return false" title="关闭" id="ql_close5c0522dd0101e262" class="blogzz_closepic SG_floatR"></a>转载列表:</h3>                <ul class="ul_zzlist" id="ql_content5c0522dd0101e262">                </ul>             <ul style="display:none"><li id="ql_tip5c0522dd0101e262"></li></ul>                <div class="SG_clearB"></div>                <div class="blogzz_btn">                    <a id="btnArticleQuote5c0522dd0101e262" href="#" onclick="scope.article_quote &amp;&amp; scope.article_quote.check('5c0522dd0101e262');return false;" class="SG_aBtn SG_aBtn_ico SG_turn"><cite><img class="SG_icon SG_icon111" id="quoteList_quote5c0522dd0101e262" src="http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif" width="15" height="15" align="absmiddle">转载</cite></a>                   <p id="quoteDescription5c0522dd0101e262" class="SG_turntxt" style="display: none;">转载是分享博文的一种常用方式...</p>                </div>              <div id="ql_page5c0522dd0101e262" class="blogzz_paged"></div>               <div class="clearit"></div></div>
    <div class="articalfrontback SG_j_linedot1 clearfix" id="new_nextprev_5c0522dd0101e262">
                        <div><span class="SG_txtb">前一篇:</span><a href="http://blog.sina.com.cn/s/blog_5c0522dd0101e260.html">Netty4.0学习笔记系列之二:Handler的执行顺序</a></div>
                                    <div><span class="SG_txtb">后一篇:</span><a href="http://blog.sina.com.cn/s/blog_5c0522dd0101e268.html">Netty4.0学习笔记系列之四:混合使用coder和handler</a></div>
                </div>
    <div class="clearit"></div>

    <div id="loginFollow"></div>
            <div class="allComm">
        <div class="allCommTit">
            <div class="SG_floatL">
                <strong>评论</strong>
                <span id="commAd_1" style="display: inline-block;">
                    <span style="margin-left:15px; width:220px; display:inline-block;"><a target="_blank" href="http://blog.sina.com.cn/lm/8/2009/0325/105340.html">重要提示:警惕虚假中奖信息</a></span>
                </span>
            </div>
            <div class="SG_floatR"><a class="CP_a_fuc" href="#post">[<cite>发评论</cite>]</a></div>
        </div>
        <ul id="article_comment_list" class="SG_cmp_revert"><li><div class="noCommdate"><span class="SG_txtb">做第一个评论者吧! <img class="SG_icon SG_icon134" src="http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif" title="" width="18" height="18" align="absmiddle"><a href="#post">抢沙发&gt;&gt;</a></span></div></li></ul>
        <div class="clearit"></div>
        <div class="myCommPages SG_j_linedot1" style="display: none;">
            <div class="SG_page" id="commentPaging" style="display: none; text-align: center;"><a href="javascript:void(0);" style="">点击加载更多</a></div>
            <div class="clearit"></div>
        </div>
        <a name="post"></a>
        <div class="writeComm">
            <div class="allCommTit">
                <div class="SG_floatL">
                    <strong>发评论</strong>
                    <span></span>
                </div>
                <div class="SG_floatR"></div>
            </div>
            <div class="wrCommTit">
                <div class="SG_floatL" id="commentNick" style="display:none;"></div>
            </div>
            <div class="formTextarea">
                <div style="float:left;" id="commonComment">
                <iframe id="postCommentIframe" style="border:1px solid #C7C7C7;
    height:158px;width:448px;maring-top:1px;background-color:white;" src="http://blog.sina.com.cn/main_v5/ria/blank2.html" frameborder="0"></iframe>
                <textarea id="commentArea" tabindex="1" style="display:none;"></textarea>
                </div>
                <div id="mobileComment" style="float:left;display:none;">
                    <textarea id="mbCommentTa" style="width:438px;height:150px;border:1px solid #C7C7C7;line-height:18px;padding:5px;"></textarea>
                </div>
                <div class="faceblk" id="faceWrap">
                    <div id="smilesSortShow" class="faceline1">
                    <div class="facestyle" id="recomm_1512112934160"><a href="#" key="302"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/302-25.gif" alt="小新小浪" title="小新小浪"></a><a href="#" key="308"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/308-25.gif" alt="炮炮兵" title="炮炮兵"></a><a href="#" key="315"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/315-25.gif" alt="张富贵" title="张富贵"></a><a href="#" key="316"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/316-25.gif" alt="旺狗" title="旺狗"></a><a href="#" key="331"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/331-25.gif" alt="悠嘻猴" title="悠嘻猴"></a><a href="#" key="351"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/351-25.gif" alt="酷巴熊" title="酷巴熊"></a></div><span class="SG_more"><a href="#">更多&gt;&gt;</a></span><div class="clearit"></div></div>
                    <ul id="smilesRecommended" class="faceline01"><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0321EN00SIGT.gif" alt="就不买你" title="就不买你" width="50" height="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0320EN00SIGT.gif" alt="股市" title="股市" width="50" height="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0319EN00SIGT.gif" alt="发霉" title="发霉" width="50" height="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0318EN00SIGT.gif" alt="陈水边" title="陈水边" width="50" height="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0317EN00SIGT.gif" alt="裁员" title="裁员" width="50" height="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0316EN00SIGT.gif" alt="音乐" title="音乐" width="50" height="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0315EN00SIGT.gif" alt="贴你" title="贴你" width="50" height="50"></a></li><li><a href="#"><img src="http://www.sinaimg.cn/uc/myshow/blog/misc/gif/E___0314EN00SIGT.gif" alt="抢车位" title="抢车位" width="50" height="50"></a></li></ul>
                </div>
                <div class="clearit"></div>
            </div>
            <div class="formLogin">
                <div class="SG_floatL"> 
                <p id="commentlogin" style="display: block;"><span>登录名:</span><input style="width: 115px;" id="login_name" tabindex="2" type="text">   <span>密码:</span><input style="width: 115px;" id="login_pass" tabindex="3" type="password">   <a href="https://login.sina.com.cn/getpass.html" target="_blank">找回密码</a>   <a href="https://login.sina.com.cn/signup/signup.php?entry=blog&amp;src=blogicp&amp;srcuid=1543840477" target="_blank">注册</a>   <input id="login_remember" type="checkbox"><label for="login_remember" style="display:inline-block;" title="建议在网吧/公用电脑上取消该选项">记住登录状态</label></p><p id="commentloginM" style="display:none;"><span>昵&nbsp;&nbsp;&nbsp;称:</span><input style="width: 115px;" id="comment_anonyous" value="新浪网友" tabindex="2" disabled="" type="text"></p><p id="quote_comment_p"><!--<input type="checkbox" id="bb"> <label for="bb"><img height="18" align="absmiddle" width="18" title="" src="http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif" class="SG_icon SG_icon110">分享到微博 <img height="15" align="absmiddle" width="15" title="新" src="http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif" class="SG_icon SG_icon11"></label>&nbsp;&nbsp;&nbsp;--><input id="cbCommentQuote" type="checkbox"><label for="cbCommentQuote">评论并转载此博文</label><img class="SG_icon SG_icon11" src="http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif" title="新" width="15" height="15" align="absmiddle"></p>
                <p id="geetest-box"></p>
                </div>

                <span style="display: none; color: rgb(153, 153, 153); margin-left: 10px;" id="login_remember_caution"></span>

                                        <!--<div class="SG_floatR" id="anonymity_cont"><input type="checkbox" id="anonymity"/><label for="anonymity">匿名评论</label></div>-->
                                </div>
            <div class="formBtn">
                <a href="javascript:;" onclick="return false;" class="SG_aBtn" tabindex="5"><cite id="postcommentid">发评论</cite></a>
                <p class="SG_txtc">以上网友发言只代表其个人观点,不代表新浪网的观点或立场。</p>
            </div>
        </div>
    </div>
            <div class="clearit"></div>

            <div class="articalfrontback articalfrontback2 clearfix">
                      <div class="SG_floatL"><span class="SG_txtb">&lt;&nbsp;前一篇</span><a href="http://blog.sina.com.cn/s/blog_5c0522dd0101e260.html">Netty4.0学习笔记系列之二:Handler的执行顺序</a></div>
                                  <div class="SG_floatR"><span class="SG_txtb">后一篇&nbsp;&gt;</span><a href="http://blog.sina.com.cn/s/blog_5c0522dd0101e268.html">Netty4.0学习笔记系列之四:混合使用coder和handler</a></div>
                </div>
    <div class="clearit"></div>

</div>
<!--博文正文 end -->
    <script type="text/javascript">
        var voteid="";
    </script>
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值