基于Netty的服务端长连接

来源:互联网 发布:快速排序算法java递归 编辑:程序博客网 时间:2024/05/21 14:01

转载自:http://wenxin2009.iteye.com/blog/1707304


Netty是由JBOSS提供的一个java开源框架,基于nio。Netty提供异步的、事件驱动的网络应用程序框架和工具,用以快速开发高性能、高可靠性的网络服务器和客户端程序。

官网:http://netty.io/

websocket通信示例如下(以下使用的netty版本为3.6.1):

说明:

  通信服务端运用Netty,Netty中自带Jboss,iphone使用SocketRocket,进行推送数据。

随便画的草图:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" dir="ltr">  <head>    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>    <title>Netty服务器向网页、iphone客户端推数据 -  - ITeye技术网站</title>    <meta name="description" content="   Netty是由JBOSS提供的一个java开源框架,基于nio。Netty提供异步的、事件驱动的网络应用程序框架和工具,用以快速开发高性能、高可靠性的网络服务器和客户端程序。  官网:http://netty.io/  websocket通信示例如下(以下使用的netty版本为3.6.1):  说明:    通信服务端运用Netty,Netty中自带Jboss,iphone使用SocketRo ..." />    <meta name="keywords" content=" Netty服务器向网页、iphone客户端推数据" />    <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" />    <link rel="search" type="application/opensearchdescription+xml" href="/open_search.xml" title="ITeye" />    <link href="/rss" rel="alternate" title="" type="application/rss+xml" />    <link href="http://www.iteye.com/stylesheets/blog.css?1442202041" media="screen" rel="stylesheet" type="text/css" /><link href="http://www.iteye.com/stylesheets/themes/blog/blue.css?1326191326" media="screen" rel="stylesheet" type="text/css" />    <script src="http://www.iteye.com/javascripts/application.js?1358214518" type="text/javascript"></script>    <script type="text/javascript">  var _gaq = _gaq || [];  _gaq.push(['_setAccount', 'UA-535605-1']);  _gaq.push(['_setDomainName', 'iteye.com']);  _gaq.push(['_trackPageview']);  (function() {    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);  })();</script>      <link href="http://www.iteye.com/javascripts/syntaxhighlighter/SyntaxHighlighter.css?1348819953" media="screen" rel="stylesheet" type="text/css" />  <script src="http://www.iteye.com/javascripts/syntaxhighlighter/shCoreCommon.js?1325907333" type="text/javascript"></script><script src="http://www.iteye.com/javascripts/hotkey.js?1324994303" type="text/javascript"></script>  <script src="http://www.iteye.com/javascripts/code_favorites.js?1358214518" type="text/javascript"></script><script src="http://www.iteye.com/javascripts/weiboshare.js?1324994303" type="text/javascript"></script>  </head>  <body>    <div id="header">      <div id="blog_site_nav">  <a href="http://www.iteye.com/" class="homepage">首页</a>  <a href="http://www.iteye.com/news">资讯</a>  <a href="http://www.iteye.com/magazines">精华</a>  <a href="http://www.iteye.com/forums">论坛</a>  <a href="http://www.iteye.com/ask">问答</a>  <a href="http://www.iteye.com/blogs">博客</a>  <a href="http://www.iteye.com/blogs/subjects">专栏</a>  <a href="http://www.iteye.com/groups">群组</a>  <a href="#" onclick="return false;" id="msna"><u>更多</u> <small>▼</small></a>  <div class="quick_menu" style="display:none;">    <a target="_blank" href="http://job.iteye.com/iteye">招聘</a>    <a href="http://www.iteye.com/search">搜索</a>  </div></div>      <div id="user_nav">      <a href="/login" class="welcome" title="登录">您还未登录 !</a>    <a href="/login">登录</a>    <a href="/signup" class="nobg">注册</a>  </div>    </div>    <div id="page">      <div id="branding" class="clearfix">        <div id="blog_name">          <h1><a href="/">wenxin2009</a></h1>        </div>        <div id='fd'></div>        <div id="blog_navbar">          <ul>            <li class='blog_navbar_for'><a href="http://wenxin2009.iteye.com"><strong>博客</strong></a></li>            <li ><a href="/weibo">微博</a></li>            <li ><a href="/album">相册</a></li>            <li ><a href="/link">收藏</a></li>            <li ><a href="/blog/guest_book">留言</a></li>            <li ><a href="/blog/profile">关于我</a></li>          </ul>              <div class="search">            <form action="/blog/search" method="get">              <input class="search_text" id="query" name="query" style="margin-left: 10px;width: 110px;" type="text" value="" />              <input class="submit_search" type="submit" value="" />            </form>          </div>           <div id="fd"></div>                 </div>      </div>            <div id="content" class="clearfix">        <div id="main">                    <div class="h-entry" style='display:none'>  <a href="http://wenxin2009.iteye.com" class="p-author" target="_blank">wenxin2009</a></div><div class="blog_main">  <div class="blog_title">    <h3>      <a href="/blog/1707304">Netty服务器向网页、iphone客户端推数据</a>      <em class="actions">      </em>    </h3>    <ul class='blog_categories'><strong>博客分类:</strong> <li><a href="/category/180167">ios</a></li> </ul>        <div class='news_tag'> </div>  </div>  <div id="blog_content" class="blog_content">    <div class="iteye-blog-content-contain" style="font-size: 14px;"><p><span style="font-size: 16px;"> <span style="font-size: 16px;">Netty</span><span style="font-size: 16px;">是由</span><span style="font-size: 16px;">JBOSS</span><span style="font-size: 16px;">提供的一个</span><span style="font-size: 16px;">java</span><span style="font-size: 16px;">开源框架</span><span style="font-size: 16px;">,</span><span style="font-size: 16px;">基于</span><span style="font-size: 16px;">nio</span><span style="font-size: 16px;">。</span><span style="font-size: 16px;">Netty</span><span style="font-size: 16px;">提供异步的、事件驱动的网络应用程序框架和工具,用以快速开发高性能、高可靠性的网络服务器和客户端程序。</span></span></p><p><span style="font-size: medium;"><span style="line-height: 24px;">官网:http://netty.io/</span></span></p><p><span style="font-size: medium;"><span style="font-size: medium;">websocket通信示例如下(以下使用的netty版本为</span></span><span style="line-height: 1.5;">3.6.1</span><span style="font-size: medium; line-height: 1.5;">):</span></p><p><span style="font-size: 16px;">说明:</span></p><p><span style="font-size: 16px;">  通信服务端运用Netty,Netty中自带Jboss,iphone使用SocketRocket,进行推送数据。</span></p><p><span style="font-size: 16px;">随便画的草图:</span></p><p><br><img alt="" src="http://dl.iteye.com/upload/attachment/0075/7943/ecd07df6-d0c0-38f0-97b5-9f9e9e88684d.jpg"></p><p> </p><p><span style="font-size: 16px;">SocketRocket关健代码(引入SocketRocket相关包和文件,官网上有下):</span></p><pre class="c" name="code">- (void)viewDidLoad{    [super viewDidLoad];//Socket    _webSocket.delegate = nil;    [_webSocket close];    _webSocket = [[SRWebSocket alloc] initWithURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"ws://127.0.0.0:8080/websocket"]]];    _webSocket.delegate = self;    [_webSocket open];    NSLog(@"open success!");}#pragma mark - SRWebSocketDelegate- (void)webSocketDidOpen:(SRWebSocket *)webSocket;{    NSLog(@"Websocket Connected");    self.title = @"Connected!";}- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error;{    NSLog(@":( Websocket Failed With Error %@", error);    _webSocket = nil;}- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message;{    NSLog(@"Received \"%@\"", message);    self.showTxt.text = message;}- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;{    NSLog(@"WebSocket closed");    self.title = @"Connection Closed! (see logs)";    _webSocket = nil;}</pre><p> </p><p><span style="font-size: 16px;">网页WebSocket关代码:</span></p><pre class="js" name="code"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html lang="zh-CN"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"/><!-- WebSocket --><!-- 注:有的浏览器需要判断进行特别处理websocket --><script type="text/javascript">var websocket;function init(){window.WebSocket = window.WebSocket || window.MozWebSocket;if(!window.WebSocket){alert("WebSocket not support browser!");return;}websocket = new WebSocket("ws://127.0.0.0:8080/websocket");websocket.onopen = function (evt){onOpen(evt)};websocket.onclose = function (evt){onClose(evt)};websocket.onmessage = function (evt){onMessage(evt)};websocket.onerror = function (evt){onError(evt)};}function onOpen(evt){//alert("connect open!");}function onClose(evt){//alert("connect close!");}function onMessage(evt){/* var data = evt.data;if(!data){return;}alert(data); */var msg = document.getElementById('responseText');msg.value = msg.value+"\n"+evt.data;}function onError(evt){alert("connect error!");}//发送消息function send(message){if(!window.WebSocket){return;}if(websocket.readyState == WebSocket.OPEN){websocket.send(message);}else{alert("The websocket is not open!");}}</script></head><body onload="init()"><form onsubmit="return false;"><input type="text" name="message"></input><br/><input type="button" value="发送" onclick="send(this.form.message.value)"></input><br/><h3>输出:</h3><textarea id="responseText" style="width:500px;height:300px;"></textarea></form></body></html></pre><p> </p><p><span style="font-size: 16px;">Netty代码:</span></p><pre class="java" name="code">public class WebSocketServer {    private final int port;    public WebSocketServer(int port) {        this.port = port;    }    public void run() {        // Configure the server.        ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(                Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));        // Set up the event pipeline factory.        bootstrap.setPipelineFactory(new WebSocketServerPipelineFactory());        // Bind and start to accept incoming connections.        bootstrap.bind(new InetSocketAddress(port));        System.out.println("Web socket server started at port " + port + '.');        System.out.println("Open your browser and navigate to http://localhost:" + port + '/');    }    public static void main(String[] args) {        int port;        if (args.length > 0) {            port = Integer.parseInt(args[0]);        } else {            port = 8080;        }        new WebSocketServer(port).run();    }}</pre><p> </p><pre class="java" name="code">/** * Handles handshakes and messages */public class WebSocketServerHandler extends SimpleChannelUpstreamHandler {    private static final InternalLogger logger = InternalLoggerFactory.getInstance(WebSocketServerHandler.class);    private static final String WEBSOCKET_PATH = "/websocket";    private WebSocketServerHandshaker handshaker;        //频道channel    private static  List<Channel> channels = null;    private static  ChannelGroup channelG = null;        static{    channels =  new ArrayList<Channel>();    channelG = new DefaultChannelGroup();    System.out.println("staic...............");    }    @Override    public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {        Object msg = e.getMessage();        if (msg instanceof HttpRequest) {            handleHttpRequest(ctx, (HttpRequest) msg);        } else if (msg instanceof WebSocketFrame) {            handleWebSocketFrame(ctx, (WebSocketFrame) msg);        }    }    /**     * 请求分发到页面     * @param ctx     * @param req     * @throws Exception     */    private void handleHttpRequest(ChannelHandlerContext ctx, HttpRequest req) throws Exception {        // Allow only GET methods.        if (req.getMethod() != GET) {            sendHttpResponse(ctx, req, new DefaultHttpResponse(HTTP_1_1, FORBIDDEN));            return;        }                // Send the demo page and favicon.ico        if (req.getUri().equals("/")) {            HttpResponse res = new DefaultHttpResponse(HTTP_1_1, OK);            ChannelBuffer content = WebSocketServerIndexPage.getContent(getWebSocketLocation(req));            res.setHeader(CONTENT_TYPE, "text/html; charset=UTF-8");            setContentLength(res, content.readableBytes());            res.setContent(content);            sendHttpResponse(ctx, req, res);            return;        } else if (req.getUri().equals("/favicon.ico")) {            HttpResponse res = new DefaultHttpResponse(HTTP_1_1, NOT_FOUND);            sendHttpResponse(ctx, req, res);            return;        }        // Handshake        WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory(                getWebSocketLocation(req), null, false);        handshaker = wsFactory.newHandshaker(req);        if (handshaker == null) {            wsFactory.sendUnsupportedWebSocketVersionResponse(ctx.getChannel());        } else {            handshaker.handshake(ctx.getChannel(), req).addListener(WebSocketServerHandshaker.HANDSHAKE_LISTENER);        }    }    private void handleWebSocketFrame(ChannelHandlerContext ctx, WebSocketFrame frame) {        // Check for closing frame        if (frame instanceof CloseWebSocketFrame) {            handshaker.close(ctx.getChannel(), (CloseWebSocketFrame) frame);            return;        } else if (frame instanceof PingWebSocketFrame) {            ctx.getChannel().write(new PongWebSocketFrame(frame.getBinaryData()));            return;        } else if (!(frame instanceof TextWebSocketFrame)) {            throw new UnsupportedOperationException(String.format("%s frame types not supported", frame.getClass()                    .getName()));        }        // Send the uppercase string back.        String request = ((TextWebSocketFrame) frame).getText();        if (null != request) {          System.out.println(String.format("Channel %s received %s", ctx.getChannel().getId(), request));              if (logger.isDebugEnabled()) {                  logger.debug(String.format("Channel %s received %s", ctx.getChannel().getId(), request));              }//              ctx.getChannel().write(new TextWebSocketFrame(request.toUpperCase()));              channelG.write(new TextWebSocketFrame(request.toUpperCase()));              //循环频道//              System.err.println(channels.size());//              for (int i = 0; i < channels.size(); i++) {//      channels.get(i).write(new TextWebSocketFrame(request.toUpperCase()));//      }}    }    private static void sendHttpResponse(ChannelHandlerContext ctx, HttpRequest req, HttpResponse res) {        // Generate an error page if response status code is not OK (200).        if (res.getStatus().getCode() != 200) {            res.setContent(ChannelBuffers.copiedBuffer(res.getStatus().toString(), CharsetUtil.UTF_8));            setContentLength(res, res.getContent().readableBytes());        }        // Send the response and close the connection if necessary.        ChannelFuture f = ctx.getChannel().write(res);        if (!isKeepAlive(req) || res.getStatus().getCode() != 200) {            f.addListener(ChannelFutureListener.CLOSE);        }    }    @Override    public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {        e.getCause().printStackTrace();        e.getChannel().close();        System.out.println("exceptionCaught=============");    }    private static String getWebSocketLocation(HttpRequest req) {        return "ws://" + req.getHeader(HttpHeaders.Names.HOST) + WEBSOCKET_PATH;    }    @Overridepublic void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e)throws Exception {// super.channelConnected(ctx, e);//channels.add(e.getChannel());channelG.add(e.getChannel());//channelG.addAll(channels);}      @Override   public void channelDisconnected(ChannelHandlerContext ctx,     ChannelStateEvent e) throws Exception {     super.channelDisconnected(ctx, e);   }   }</pre><p> </p><pre class="java" name="code">/** * Generates the demo HTML page which is served at http://localhost:8080/页面(该页面写在代码的形式输出) */public final class WebSocketServerIndexPage {    private static final String NEWLINE = "\r\n";    public static ChannelBuffer getContent(String webSocketLocation) {        return ChannelBuffers.copiedBuffer(                "<html><head><title>Web Socket Test</title></head>" + NEWLINE +                "<body>" + NEWLINE +                "<script type=\"text/javascript\">" + NEWLINE +                "var socket;" + NEWLINE +                "if (!window.WebSocket) {" + NEWLINE +                "  window.WebSocket = window.MozWebSocket;" + NEWLINE +                "}" + NEWLINE +                "if (window.WebSocket) {" + NEWLINE +                "  socket = new WebSocket(\"" + webSocketLocation + "\");" + NEWLINE +                "  socket.onmessage = function(event) {" + NEWLINE +                "    var ta = document.getElementById('responseText');" + NEWLINE +                "    ta.value = ta.value + '\\n' + event.data" + NEWLINE +                "  };" + NEWLINE +                "  socket.onopen = function(event) {" + NEWLINE +                "    var ta = document.getElementById('responseText');" + NEWLINE +                "    ta.value = \"Web Socket opened!\";" + NEWLINE +                "  };" + NEWLINE +                "  socket.onclose = function(event) {" + NEWLINE +                "    var ta = document.getElementById('responseText');" + NEWLINE +                "    ta.value = ta.value + \"Web Socket closed\"; " + NEWLINE +                "  };" + NEWLINE +                "} else {" + NEWLINE +                "  alert(\"Your browser does not support Web Socket.\");" + NEWLINE +                "}" + NEWLINE +                NEWLINE +                "function send(message) {" + NEWLINE +                "  if (!window.WebSocket) { return; }" + NEWLINE +                "  if (socket.readyState == WebSocket.OPEN) {" + NEWLINE +                "    socket.send(message);" + NEWLINE +                "  } else {" + NEWLINE +                "    alert(\"The socket is not open.\");" + NEWLINE +                "  }" + NEWLINE +                "}" + NEWLINE +                "</script>" + NEWLINE +                "<form onsubmit=\"return false;\">" + NEWLINE +                "<input type=\"text\" name=\"message\" value=\"Hello, World!\"/>" +                "<input type=\"button\" value=\"Send Web Socket Data\"" + NEWLINE +                "       onclick=\"send(this.form.message.value)\" />" + NEWLINE +                "<h3>Output</h3>" + NEWLINE +                "<textarea id=\"responseText\" style=\"width:500px;height:300px;\"></textarea>" + NEWLINE +                "</form>" + NEWLINE +                "</body>" + NEWLINE +                "</html>" + NEWLINE, CharsetUtil.US_ASCII);    }    private WebSocketServerIndexPage() {        // Unused    }}</pre><p> </p><pre class="java" name="code">/** */public class WebSocketServerPipelineFactory implements ChannelPipelineFactory {    public ChannelPipeline getPipeline() throws Exception {        // Create a default pipeline implementation.        ChannelPipeline pipeline = pipeline();        pipeline.addLast("decoder", new HttpRequestDecoder());        pipeline.addLast("aggregator", new HttpChunkAggregator(65536));        pipeline.addLast("encoder", new HttpResponseEncoder());        pipeline.addLast("handler", new WebSocketServerHandler());        return pipeline;    }}</pre><p> </p><p><span style="font-size: 16px;">注:在推前两次请求时会报</span></p><p><span style="font-size: 16px;">java.lang.IllegalArgumentException: unsupported message type: class org.jboss.netty.handler.codec.http.websocketx.TextWebSocketFrame</span><br><span style="font-size: 16px;"> 暂末找到原因,不过不影响程序的运行,跟进中......</span></p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p><p> </p></div>  </div>    <div class="attachments">                  <ul style="display:none;">          <li><a href="http://dl2.iteye.com/upload/attachment/0075/7943/ecd07df6-d0c0-38f0-97b5-9f9e9e88684d.jpg" target="_blank"><img src='http://dl2.iteye.com/upload/attachment/0075/7943/ecd07df6-d0c0-38f0-97b5-9f9e9e88684d-thumb.jpg' class='magplus' title='点击查看原始大小图片' /></a></li>                    <li>大小: 24 KB</li>        </ul>                        <ul style="display:none;">          <li><a href="http://dl2.iteye.com/upload/attachment/0075/7945/c3c89ff5-9d31-39f4-bef4-c8b6f42b3693.jpg" target="_blank"><img src='http://dl2.iteye.com/upload/attachment/0075/7945/c3c89ff5-9d31-39f4-bef4-c8b6f42b3693-thumb.jpg' class='magplus' title='点击查看原始大小图片' /></a></li>                    <li>大小: 8.3 KB</li>        </ul>                    <ul>        <li><a href="#" onclick="$$('div.attachments ul').invoke('show');$(this).up(1).hide();return false;">查看图片附件</a></li>      </ul>      </div>      <IFRAME SRC="/iframe_ggbd/187" SCROLLING=no WIDTH=468 HEIGHT=60 FRAMEBORDER=0></IFRAME>    <div id="bottoms" class="clearfix">        <div id="share_weibo">分享到:      <a data-type='sina' href="javascript:;" title="分享到新浪微博"><img src="/images/sina.jpg"></a>      <a data-type='qq' href="javascript:;" title="分享到腾讯微博"><img src="/images/tec.jpg"></a>    </div>  </div>  <div class="blog_nav">    <div class="pre_next">      <a href="/blog/1921366" class="next" title="JS复习二">JS复习二</a>      |      <a href="/blog/1853261" class="pre" title="HttpClient post和get提交http">HttpClient post和get提交http</a>    </div>  </div>  <div class="blog_bottom">    <ul>      <li>2013-07-19 22:35</li>      <li>浏览 4171</li>      <li><a href="#comments">评论(0)</a></li>                  <li>分类:<a href="http://www.iteye.com/blogs/category/mobile">移动开发</a></li>            <li class='last'><a href="http://www.iteye.com/wiki/blog/1707304" target="_blank" class="more">相关推荐</a></li>    </ul>  </div>  <div class="blog_comment">    <h5>评论</h5>    <a id="comments" name="comments"></a>              </div>  <div class="blog_comment">    <h5>发表评论</h5>            <p style="text-align:center; margin-top:30px;margin-bottom:0px;"><a href="/login" style="background-color:white;"> <img src="/images/login_icon.png" style="vertical-align:middle; margin-right: 10px;" /></a><a href="/login">  您还没有登录,请您登录后再发表评论 </a></p>      </div></div><script type="text/javascript">  dp.SyntaxHighlighter.HighlightAll('code', true, true);  $$('#main .blog_content pre[name=code]').each(function(pre, index){ // blog content    var post_id = 1707304;    var location = window.location;    source_url = location.protocol + "//" + location.host + location.pathname + location.search;    pre.writeAttribute('codeable_id', post_id);    pre.writeAttribute('codeable_type', "Blog");    pre.writeAttribute('source_url', source_url);    pre.writeAttribute('pre_index', index);    pre.writeAttribute('title', 'Netty服务器向网页、iphone客户端推数据');  });  fix_image_size($$('div.blog_content img'), 700);  function processComment() {    $$('#main .blog_comment > div').each(function(comment){// comment      var post_id = comment.id.substr(2);      $$("#"+comment.id+" pre[name=code]").each(function(pre, index){        var location = window.location;        source_url = location.protocol + "//" + location.host + location.pathname + location.search;        source_url += "#" + comment.id;        pre.writeAttribute('codeable_id', post_id);        pre.writeAttribute('codeable_type', "BlogComment");        pre.writeAttribute('source_url', source_url);        pre.writeAttribute('pre_index', index);        pre.writeAttribute('title', 'Netty服务器向网页、iphone客户端推数据');      });    });  }  function quote_comment(id) {    new Ajax.Request('/editor/quote', {      parameters: {'id':id, 'type':'BlogComment'},      onSuccess:function(response){editor.bbcode_editor.textarea.insertAfterSelection(response.responseText);        Element.scrollTo(editor.bbcode_editor.textarea.element);}    });  }  code_favorites_init();  processComment();  new WeiboShare({share_buttons: $('share_weibo'), img_scope: $('blog_content')});</script>        </div>        <div id="local">          <div class="local_top"></div>          <div id="blog_owner">  <div id="blog_owner_logo"><a href='http://wenxin2009.iteye.com'><img alt="wenxin2009的博客" class="logo" src="http://www.iteye.com/upload/logo/user/888938/74086eef-9afe-3f46-b5d1-850607d58cf0.jpg?1378108365" title="wenxin2009的博客: " width="" /></a></div>  <div id="blog_owner_name">wenxin2009</div></div>          <div id="blog_actions">            <ul>              <li>浏览: 100761 次</li>              <li>性别: <img alt="Icon_minigender_1" src="http://www.iteye.com/images/icon_minigender_1.gif?1324994303" title="男" /></li>              <li>来自: 上海</li>              <li><img src='/images/status/offline.gif'/></li>                          </ul>          </div>          <div id="user_visits" class="clearfix">            <h5>最近访客 <span style='font-weight:normal;font-size:12px;padding-left:30px;'><a href="/blog/user_visits">更多访客>></a></span></h5>                          <div class="user_visit">                <div class="logo"><a href='http://leeyisoft.iteye.com' target='_blank'><img alt="leeyisoft的博客" class="logo" src="http://www.iteye.com/images/user-logo-thumb.gif?1324994303" title="leeyisoft的博客: " width="48px" /></a></div>                <div class="left"><a href='http://leeyisoft.iteye.com' target='_blank' title='leeyisoft'>leeyisoft</a></div>              </div>                          <div class="user_visit">                <div class="logo"><a href='http://s807880748.iteye.com' target='_blank'><img alt="s807880748的博客" class="logo" src="http://www.iteye.com/images/user-logo-thumb.gif?1324994303" title="s807880748的博客: " width="48px" /></a></div>                <div class="left"><a href='http://s807880748.iteye.com' target='_blank' title='s807880748'>s807880748</a></div>              </div>                          <div class="user_visit">                <div class="logo"><a href='http://louistz.iteye.com' target='_blank'><img alt="louistz的博客" class="logo" src="http://www.iteye.com/images/user-logo-thumb.gif?1324994303" title="louistz的博客: " width="48px" /></a></div>                <div class="left"><a href='http://louistz.iteye.com' target='_blank' title='louistz'>louistz</a></div>              </div>                          <div class="user_visit">                <div class="logo"><a href='http://zwl187--cn.iteye.com' target='_blank'><img alt="zwl187__cn的博客" class="logo" src="http://www.iteye.com/images/user-logo-thumb.gif?1324994303" title="zwl187__cn的博客: " width="48px" /></a></div>                <div class="left"><a href='http://zwl187--cn.iteye.com' target='_blank' title='zwl187__cn'>zwl187__cn</a></div>              </div>                      </div>                                <div id="blog_menu">              <h5>文章分类</h5>              <ul>                <li><a href="/">全部博客 (94)</a></li>                                  <li><a href="/category/180167">ios (48)</a></li>                                  <li><a href="/category/211734">Oracle (4)</a></li>                                  <li><a href="/category/211735">Linux (1)</a></li>                                  <li><a href="/category/232073">Spring (2)</a></li>                                  <li><a href="/category/236337">struts2 (1)</a></li>                                  <li><a href="/category/245691">js (3)</a></li>                                  <li><a href="/category/255799">Android (1)</a></li>                                  <li><a href="/category/255800">java (17)</a></li>                                  <li><a href="/category/256836">c++ (0)</a></li>                                  <li><a href="/category/258404">Lucene (1)</a></li>                                  <li><a href="/category/264208">mysql (2)</a></li>                                  <li><a href="/category/280956">新技术 (2)</a></li>                                  <li><a href="/category/295568">Scala (0)</a></li>                                  <li><a href="/category/297832">架构 (1)</a></li>                              </ul>            </div>            <div id='month_blogs'>              <h5>社区版块</h5>              <ul>                <li><a href="/blog/news">我的资讯</a> (0)</li>                <li>                  <a href="/blog/post">我的论坛</a> (0)                </li>                <li><a href="/blog/answered_problems">我的问答</a> (0)</li>              </ul>            </div>            <div id="month_blogs">              <h5>存档分类</h5>              <ul>                                  <li><a href="/blog/monthblog/2015-10">2015-10</a> (2)</li>                                  <li><a href="/blog/monthblog/2015-09">2015-09</a> (1)</li>                                  <li><a href="/blog/monthblog/2015-08">2015-08</a> (1)</li>                                <li><a href="/blog/monthblog_more">更多存档...</a></li>              </ul>            </div>                                    <div id="guest_books">              <h5>最新评论</h5>              <ul>                                <li>                  <a href='http://wiwi1024.iteye.com' target='_blank' title='wiwi1024'>wiwi1024</a>:                   PerfectHand 写道为什么没有 sql那一部分呢 求s ...<br />                  <a href="/blog/1457196#bc2374010">Ibatis批量插入数据</a>                </li>                                <li>                  <a href='http://wenxin2009.iteye.com' target='_blank' title='wenxin2009'>wenxin2009</a>:                   sql那部分就跟平常sql一样,一个update语句<br />                  <a href="/blog/1457196#bc2331344">Ibatis批量插入数据</a>                </li>                                <li>                  <a href='http://perfecthand.iteye.com' target='_blank' title='PerfectHand'>PerfectHand</a>:                   为什么没有 sql那一部分呢 求sql 那一部分<br />                  <a href="/blog/1457196#bc2326718">Ibatis批量插入数据</a>                </li>                                <li>                  <a href='http://heliang0915.iteye.com' target='_blank' title='heliang0915'>heliang0915</a>:                   有源代码吗?麻烦上传一下,谢谢了!<br />                  <a href="/blog/1832389#bc2318797">Spring MVC与Mongodb整合开发实例</a>                </li>                              </ul>            </div>            <div class="local_bottom"></div>                  </div>      </div>      <div id="footer" class="clearfix">        <div id="copyright">          <hr/>          声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。若作者同意转载,必须以超链接形式标明文章原始出处和作者。<br />          &copy; 2003-2015 ITeye.com.   All rights reserved.  [ 京ICP证110151号  京公网安备110105010620 ]        </div>      </div>    </div>    <script type="text/javascript">  document.write("<img src='http://stat.iteye.com/?url="+ encodeURIComponent(document.location.href) + "&referrer=" + encodeURIComponent(document.referrer) + "&user_id=' width='0' height='0' />");</script><script src="http://csdnimg.cn/pubfooter/js/tracking.js?version=20130923164150" type="text/javascript"></script>          </body></html>


0 0
原创粉丝点击