{"id":24540,"date":"2025-04-19T10:21:08","date_gmt":"2025-04-19T02:21:08","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/24540.html"},"modified":"2025-04-19T10:21:08","modified_gmt":"2025-04-19T02:21:08","slug":"10%e5%b9%b4%e6%9e%b6%e6%9e%84%e5%b8%88%e6%95%99%e4%bd%a0%e4%bd%bf%e7%94%a8netty%e5%ae%9e%e7%8e%b0%e6%95%b0%e6%8d%ae%e9%87%87%e9%9b%86%e6%9c%8d%e5%8a%a1%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/24540.html","title":{"rendered":"10\u5e74\u67b6\u6784\u5e08\u6559\u4f60\u4f7f\u7528Netty\u5b9e\u73b0\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668"},"content":{"rendered":"<h2>\u4f7f\u7528Netty\u5b9e\u73b0\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668<\/h2>\n<p>\u4e3a\u4e86\u66f4\u597d\u5730\u8bb2\u89e3\u5982\u4f55\u7ed3\u5408NIO\u548c\u5f02\u6b65\u7f16\u7a0b\u4ee5\u5b9e\u73b0\u652f\u6301\u9ad8\u5e76\u53d1\u3001\u9ad8\u6027\u80fd\u7684\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668\uff0c\u672c\u8282\u91c7\u7528Netty\u6846\u67b6\u91cd\u6784\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668\u3002Netty\u662f\u4e00\u4e2a\u57fa\u4e8eNIO\u7684\u5f02\u6b65\u4e8b\u4ef6\u9a71\u52a8\u7f51\u7edc\u5e94\u7528\u6846\u67b6\uff0c\u7528\u4e8e\u5feb\u901f\u5f00\u53d1\u5177\u6709\u53ef\u7ef4\u62a4\u6027\u7684\u9ad8\u6027\u80fd\u534f\u8bae\u670d\u52a1\u5668\u548c\u5ba2\u6237\u7aef\u3002Netty\u4e2d\u7684\u4e00\u4e9b\u6982\u5ff5\u548c\u8bbe\u8ba1\u6a21\u5f0f\u6709\u4e9b\u590d\u6742\uff0c\u4f46\u662f\u975e\u5e38\u6709\u7528\uff0c\u521d\u6b21\u63a5\u89e6Netty\u7684\u8bfb\u8005\u8fd8\u662f\u9700\u8981\u5bf9\u5176\u6709\u6240\u4e86\u89e3\u3002<\/p>\n<p>\u53ef\u4ee5\u8bf4\uff0cNetty\u628aNIO\u548c\u5f02\u6b65\u7f16\u7a0b\u7684\u54f2\u5b66\u53d1\u6325\u5230\u4e86\u6dcb\u6f13\u5c3d\u81f4\u3002\u5728Netty\u4e2d\uff0c\u51e0\u4e4e\u6240\u6709\u6d89\u53ca\u7f51\u7edc\u64cd\u4f5c\u7684\u5730\u65b9\u5747\u91c7\u7528\u5f02\u6b65\u56de\u8c03\u7684\u65b9\u5f0f\u3002\u56fe2-12\u5c55\u793a\u4e86Netty\u7684\u5de5\u4f5c\u539f\u7406\u3002\u9996\u5148\uff0cNetty\u7528reactor\u7ebf\u7a0b\u76d1\u542cServerSocketChannel\uff0c\u6bcf\u4e2aServerSocketChannel\u5bf9\u5e94\u4e00\u4e2a\u5b9e\u9645\u7684\u7aef\u53e3\u3002\u5982\u679c\u9700\u8981\u76d1\u542c\u591a\u4e2a\u7aef\u53e3\uff0c\u5219\u9700\u8981\u4e3areactor\u7ebf\u7a0b\u6c60\u914d\u7f6e\u591a\u4e2a\u7ebf\u7a0b\u3002<\/p>\n<p>\u5f53reactor\u7ebf\u7a0b\u76d1\u542c\u7684ServerSocketChannel\u76d1\u6d4b\u5230\u8fde\u63a5\u8bf7\u6c42\u4e8b\u4ef6\uff08OP_ACCEPT\uff09\u65f6\uff0c\u5c31\u4e3a\u63a5\u6536\u5230\u7684\u8fde\u63a5\u5957\u63a5\u5b57\u5efa\u7acb\u4e00\u4e2aSocketChannel\uff0c\u5e76\u5c06\u8be5SocketChannel\u59d4\u6258\u7ed9\u5de5\u4f5c\u7ebf\u7a0b\u6c60\u4e2d\u7684\u67d0\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u505a\u540e\u7eed\u5904\u7406\u3002\u4e4b\u540e\uff0c\u5f53\u5de5\u4f5c\u7ebf\u7a0b\u76d1\u6d4b\u5230SocketChannel\u4e0a\u6709\u6570\u636e\u53ef\u8bfb\uff08OP_READ\uff09\u65f6\uff0c\u5c31\u8c03\u7528\u76f8\u5173\u7684\u56de\u8c03\u53e5\u67c4\uff08handler\uff09\u5bf9\u6570\u636e\u8fdb\u884c\u8bfb\u53d6\u548c\u5904\u7406\uff0c\u5e76\u8fd4\u56de\u6700\u7ec8\u7684\u5904\u7406\u7ed3\u679c\u3002\u53e6\u5916\uff0c\u5728Netty\u76f8\u5173\u4ee3\u7801\u4e2d\uff0c\u901a\u5e38\u5c06reactor\u7ebf\u7a0b\u6c60\u79f0\u4e3aboss group\uff0c\u800c\u5c06\u5de5\u4f5c\u7ebf\u7a0b\u6c60\u79f0\u4e3awork group\uff0c\u5927\u5bb6\u5728\u9605\u8bfbNetty\u76f8\u5173\u4ee3\u7801\u65f6\u77e5\u6653\u8fd9\u4e24\u4e2a\u6982\u5ff5\u5373\u53ef\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"708\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419022107-6803089357a04.png\" width=\"894\"><\/p>\n<p>\u56fe2-12 Netty\u7684\u5de5\u4f5c\u539f\u7406<\/p>\n<p>\u4f7f\u7528Netty\u5b9e\u73b0\u6570\u636e\u91c7\u96c6API<\/p>\n<p>\u4e0b\u9762\u6211\u4eec\u4f7f\u7528Netty\u6765\u5b9e\u73b0\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668\u3002<\/p>\n<p>public static void main(String[] args) {\n  <\/p>\n<p>final int port = 8081;<\/p>\n<p>final EventLoopGroup bossGroup = new NioEventLoopGroup(1);<\/p>\n<p>final EventLoopGroup workerGroup = new NioEventLoopGroup();<\/p>\n<p>try {\n  <\/p>\n<p>final ServerBootstrap bootstrap = new ServerBootstrap()<\/p>\n<p>.group(bossGroup, workerGroup)<\/p>\n<p>.channel(NioServerSocketChannel.class)<\/p>\n<p>.childHandler(new ServerInitializer())<\/p>\n<p>.option(ChannelOption.SO_BACKLOG, 1024);<\/p>\n<p>final ChannelFuture f = bootstrap.bind(port).sync();<\/p>\n<p>logger.info(String.format(\\&#8221;NettyDataCollector: running on port[%d]\\&#8221;,<\/p>\n<p>port));<\/p>\n<p>f.channel().closeFuture().sync();<\/p>\n<p>} catch (final InterruptedException e) {\n  <\/p>\n<p>logger.error(\\&#8221;NettyDataCollector: an error occurred while running\\&#8221;, e);<\/p>\n<p>} finally {\n  <\/p>\n<p>bossGroup.shutdownGracefully();<\/p>\n<p>workerGroup.shutdownGracefully();<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>public class ServerInitializer extends ChannelInitializer&lt;SocketChannel&gt; {\n  <\/p>\n<p>private static final int MAX_CONTENT_LENGTH = 1024 * 1024;<\/p>\n<p>@Override<\/p>\n<p>public void initChannel(SocketChannel ch) throws Exception {\n  <\/p>\n<p>ch.pipeline().addLast(\\&#8221;http-codec\\&#8221;, new HttpServerCodec());<\/p>\n<p>ch.pipeline().addLast(new HttpObjectAggregator(MAX_CONTENT_LENGTH));<\/p>\n<p>ch.pipeline().addLast(\\&#8221;handler\\&#8221;, new ServerHandler());<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>public class ServerHandler extends<\/p>\n<p>SimpleChannelInboundHandler&lt;HttpRequest&gt; {\n  <\/p>\n<p>private static final Logger logger = LoggerFactory.getLogger(NettyData<\/p>\n<p>Collector.class);<\/p>\n<p>private final String kafkaBroker = \\&#8221;127.0.0.1:9092\\&#8221;;<\/p>\n<p>private final String topic = \\&#8221;collector_event\\&#8221;;<\/p>\n<p>private final KafkaSender kafkaSender = new KafkaSender(kafkaBroker);<\/p>\n<p>private JSONObject doExtractCleanTransform(JSONObject event) {\n  <\/p>\n<p>\/\/ TODO: \u5b9e\u73b0\u62bd\u53d6\u3001\u6e05\u6d17\u3001\u8f6c\u5316\u5177\u4f53\u903b\u8f91<\/p>\n<p>return event;<\/p>\n<p>}<\/p>\n<p>@Override<\/p>\n<p>protected void channelRead0(ChannelHandlerContext ctx, HttpRequest req)<\/p>\n<p>throws Exception {<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.5k\u6b21\uff0c\u70b9\u8d5e15\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u8fd9\u6837\u505a\u7684\u7ed3\u679c\u662f\uff0c\u7cfb\u7edf\u6bcf\u79d2\u5904\u7406\u7684\u8bf7\u6c42\u6570\u53ef\u80fd\u901a\u8fc7\u62fc\u547d\u201c\u538b\u69a8\u201dCPU\u548cI\/O\u5f97\u5230\u4e86\u63d0\u5347\uff0c\u4f46\u540c\u65f6\u5404\u4e2a\u73af\u8282\u4efb\u52a1\u961f\u5217\u4e2d\u7684\u4efb\u52a1\u8fc7\u591a\uff0c\u589e\u52a0\u4e86\u8bf7\u6c42\u5904\u7406\u7684\u65f6\u5ef6\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u63d0\u9ad8\u5e76\u884c\u5ea6\u7684\u6574\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u4efb\u4f55\u65f6\u5019\u90fd\u5fc5\u987b\u4fdd\u8bc1\u8bf7\u6c42\u5904\u7406\u7684\u65f6\u5ef6\u662f\u6ee1\u8db3\u65f6\u5ef6\u6307\u6807\u8981\u6c42\u7684\u3002\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0cchannelRead0\u51fd\u6570\u7684\u8f93\u5165\u53c2\u6570\u662f\u4e00\u4e2aChannelHandlerContext\u5bf9\u8c61\u548c\u4e00\u4e2aHttpRequest\u5bf9\u8c61\uff0c\u5b83\u4eec\u9488\u5bf9\u6bcf\u6b21\u7684\u8bf7\u6c42\u5904\u7406\u800c\u521b\u5efa\uff0c\u6240\u4ee5\u5e76\u975e\u5168\u5c40\u7684\uff0c\u53ef\u4ee5\u5728\u4e0d\u540c\u7ebf\u7a0b\u95f4\u81ea\u7531\u5730\u4f20\u9012\u548c\u4f7f\u7528\u5b83\u4eec\uff0c\u5e76\u4e14\u4e0d\u7528\u62c5\u5fc3\u5e76\u53d1\u5b89\u5168\u7684\u95ee\u9898\u3002_\u57fa\u4e8enetty\u7684\u65e0\u963b\u585e\u9ad8\u901f\u8f6e\u8be2\u6570\u636e\u91c7\u96c6<\/p>\n","protected":false},"author":2,"featured_media":24539,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,190,100,43,44,176],"topic":[],"class_list":["post-24540","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-java","tag-190","tag-100","tag-43","tag-44","tag-176"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>10\u5e74\u67b6\u6784\u5e08\u6559\u4f60\u4f7f\u7528Netty\u5b9e\u73b0\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/24540.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"10\u5e74\u67b6\u6784\u5e08\u6559\u4f60\u4f7f\u7528Netty\u5b9e\u73b0\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.5k\u6b21\uff0c\u70b9\u8d5e15\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u8fd9\u6837\u505a\u7684\u7ed3\u679c\u662f\uff0c\u7cfb\u7edf\u6bcf\u79d2\u5904\u7406\u7684\u8bf7\u6c42\u6570\u53ef\u80fd\u901a\u8fc7\u62fc\u547d\u201c\u538b\u69a8\u201dCPU\u548cI\/O\u5f97\u5230\u4e86\u63d0\u5347\uff0c\u4f46\u540c\u65f6\u5404\u4e2a\u73af\u8282\u4efb\u52a1\u961f\u5217\u4e2d\u7684\u4efb\u52a1\u8fc7\u591a\uff0c\u589e\u52a0\u4e86\u8bf7\u6c42\u5904\u7406\u7684\u65f6\u5ef6\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u63d0\u9ad8\u5e76\u884c\u5ea6\u7684\u6574\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u4efb\u4f55\u65f6\u5019\u90fd\u5fc5\u987b\u4fdd\u8bc1\u8bf7\u6c42\u5904\u7406\u7684\u65f6\u5ef6\u662f\u6ee1\u8db3\u65f6\u5ef6\u6307\u6807\u8981\u6c42\u7684\u3002\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0cchannelRead0\u51fd\u6570\u7684\u8f93\u5165\u53c2\u6570\u662f\u4e00\u4e2aChannelHandlerContext\u5bf9\u8c61\u548c\u4e00\u4e2aHttpRequest\u5bf9\u8c61\uff0c\u5b83\u4eec\u9488\u5bf9\u6bcf\u6b21\u7684\u8bf7\u6c42\u5904\u7406\u800c\u521b\u5efa\uff0c\u6240\u4ee5\u5e76\u975e\u5168\u5c40\u7684\uff0c\u53ef\u4ee5\u5728\u4e0d\u540c\u7ebf\u7a0b\u95f4\u81ea\u7531\u5730\u4f20\u9012\u548c\u4f7f\u7528\u5b83\u4eec\uff0c\u5e76\u4e14\u4e0d\u7528\u62c5\u5fc3\u5e76\u53d1\u5b89\u5168\u7684\u95ee\u9898\u3002_\u57fa\u4e8enetty\u7684\u65e0\u963b\u585e\u9ad8\u901f\u8f6e\u8be2\u6570\u636e\u91c7\u96c6\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/24540.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-19T02:21:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419022107-6803089357a04.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/24540.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/24540.html\",\"name\":\"10\u5e74\u67b6\u6784\u5e08\u6559\u4f60\u4f7f\u7528Netty\u5b9e\u73b0\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-19T02:21:08+00:00\",\"dateModified\":\"2025-04-19T02:21:08+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/24540.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/24540.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/24540.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"10\u5e74\u67b6\u6784\u5e08\u6559\u4f60\u4f7f\u7528Netty\u5b9e\u73b0\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"10\u5e74\u67b6\u6784\u5e08\u6559\u4f60\u4f7f\u7528Netty\u5b9e\u73b0\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/24540.html","og_locale":"zh_CN","og_type":"article","og_title":"10\u5e74\u67b6\u6784\u5e08\u6559\u4f60\u4f7f\u7528Netty\u5b9e\u73b0\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.5k\u6b21\uff0c\u70b9\u8d5e15\u6b21\uff0c\u6536\u85cf11\u6b21\u3002\u8fd9\u6837\u505a\u7684\u7ed3\u679c\u662f\uff0c\u7cfb\u7edf\u6bcf\u79d2\u5904\u7406\u7684\u8bf7\u6c42\u6570\u53ef\u80fd\u901a\u8fc7\u62fc\u547d\u201c\u538b\u69a8\u201dCPU\u548cI\/O\u5f97\u5230\u4e86\u63d0\u5347\uff0c\u4f46\u540c\u65f6\u5404\u4e2a\u73af\u8282\u4efb\u52a1\u961f\u5217\u4e2d\u7684\u4efb\u52a1\u8fc7\u591a\uff0c\u589e\u52a0\u4e86\u8bf7\u6c42\u5904\u7406\u7684\u65f6\u5ef6\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u5728\u63d0\u9ad8\u5e76\u884c\u5ea6\u7684\u6574\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u4efb\u4f55\u65f6\u5019\u90fd\u5fc5\u987b\u4fdd\u8bc1\u8bf7\u6c42\u5904\u7406\u7684\u65f6\u5ef6\u662f\u6ee1\u8db3\u65f6\u5ef6\u6307\u6807\u8981\u6c42\u7684\u3002\u5728\u4e0a\u9762\u7684\u4ee3\u7801\u4e2d\uff0cchannelRead0\u51fd\u6570\u7684\u8f93\u5165\u53c2\u6570\u662f\u4e00\u4e2aChannelHandlerContext\u5bf9\u8c61\u548c\u4e00\u4e2aHttpRequest\u5bf9\u8c61\uff0c\u5b83\u4eec\u9488\u5bf9\u6bcf\u6b21\u7684\u8bf7\u6c42\u5904\u7406\u800c\u521b\u5efa\uff0c\u6240\u4ee5\u5e76\u975e\u5168\u5c40\u7684\uff0c\u53ef\u4ee5\u5728\u4e0d\u540c\u7ebf\u7a0b\u95f4\u81ea\u7531\u5730\u4f20\u9012\u548c\u4f7f\u7528\u5b83\u4eec\uff0c\u5e76\u4e14\u4e0d\u7528\u62c5\u5fc3\u5e76\u53d1\u5b89\u5168\u7684\u95ee\u9898\u3002_\u57fa\u4e8enetty\u7684\u65e0\u963b\u585e\u9ad8\u901f\u8f6e\u8be2\u6570\u636e\u91c7\u96c6","og_url":"https:\/\/www.wsisp.com\/helps\/24540.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-19T02:21:08+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250419022107-6803089357a04.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/24540.html","url":"https:\/\/www.wsisp.com\/helps\/24540.html","name":"10\u5e74\u67b6\u6784\u5e08\u6559\u4f60\u4f7f\u7528Netty\u5b9e\u73b0\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-19T02:21:08+00:00","dateModified":"2025-04-19T02:21:08+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/24540.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/24540.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/24540.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"10\u5e74\u67b6\u6784\u5e08\u6559\u4f60\u4f7f\u7528Netty\u5b9e\u73b0\u6570\u636e\u91c7\u96c6\u670d\u52a1\u5668"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/24540","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=24540"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/24540\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/24539"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=24540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=24540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=24540"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=24540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}