{"id":48645,"date":"2025-07-30T12:53:20","date_gmt":"2025-07-30T04:53:20","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/48645.html"},"modified":"2025-07-30T12:53:20","modified_gmt":"2025-07-30T04:53:20","slug":"%e6%b7%b1%e5%85%a5%e7%90%86%e8%a7%a3tomcat-server%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%8e%9f%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/48645.html","title":{"rendered":"\u6df1\u5165\u7406\u89e3Tomcat Server\u670d\u52a1\u5668\u539f\u7406"},"content":{"rendered":"<h2>\u6df1\u5165\u7406\u89e3Tomcat Server\u670d\u52a1\u5668\u539f\u7406<\/h2>\n<hr \/>\n<h3>\u4e00\u3001\u5f15\u8a00<\/h3>\n<p>Tomcat\u662f\u6700\u5e38\u7528\u7684Java Web\u670d\u52a1\u5668\u548cServlet\u5bb9\u5668&#xff0c;\u5176Server\u4f53\u7cfb\u7ed3\u6784\u627f\u8f7d\u4e86\u8bf7\u6c42\u63a5\u6536\u3001\u534f\u8bae\u89e3\u6790\u3001\u5e94\u7528\u8c03\u5ea6\u3001\u8d44\u6e90\u7ba1\u7406\u7b49\u6838\u5fc3\u529f\u80fd\u3002\u672c\u7bc7\u535a\u5ba2\u5c06\u7cfb\u7edf\u68b3\u7406Tomcat Server\u7684\u5185\u90e8\u539f\u7406&#xff0c;\u4ece\u6574\u4f53\u67b6\u6784\u5230\u6838\u5fc3\u6e90\u7801\u3001\u518d\u5230\u8c03\u8bd5\u4f18\u5316\u548c\u9ad8\u9636\u5e94\u7528&#xff0c;\u5e2e\u52a9\u4f60\u201c\u77e5\u5176\u7136&#xff0c;\u66f4\u77e5\u5176\u6240\u4ee5\u7136\u201d\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001Tomcat Server\u6574\u4f53\u67b6\u6784<\/h3>\n<h4>2.1 \u7ec4\u4ef6\u7ed3\u6784\u56fe<\/h4>\n<p>  #mermaid-svg-g2s68iyJU0L4Apy3 {font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-g2s68iyJU0L4Apy3 .error-icon{fill:#552222;}#mermaid-svg-g2s68iyJU0L4Apy3 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-g2s68iyJU0L4Apy3 .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-g2s68iyJU0L4Apy3 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-g2s68iyJU0L4Apy3 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-g2s68iyJU0L4Apy3 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-g2s68iyJU0L4Apy3 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-g2s68iyJU0L4Apy3 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-g2s68iyJU0L4Apy3 .marker.cross{stroke:#333333;}#mermaid-svg-g2s68iyJU0L4Apy3 svg{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-g2s68iyJU0L4Apy3 .label{font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;color:#333;}#mermaid-svg-g2s68iyJU0L4Apy3 .cluster-label text{fill:#333;}#mermaid-svg-g2s68iyJU0L4Apy3 .cluster-label span{color:#333;}#mermaid-svg-g2s68iyJU0L4Apy3 .label text,#mermaid-svg-g2s68iyJU0L4Apy3 span{fill:#333;color:#333;}#mermaid-svg-g2s68iyJU0L4Apy3 .node rect,#mermaid-svg-g2s68iyJU0L4Apy3 .node circle,#mermaid-svg-g2s68iyJU0L4Apy3 .node ellipse,#mermaid-svg-g2s68iyJU0L4Apy3 .node polygon,#mermaid-svg-g2s68iyJU0L4Apy3 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-g2s68iyJU0L4Apy3 .node .label{text-align:center;}#mermaid-svg-g2s68iyJU0L4Apy3 .node.clickable{cursor:pointer;}#mermaid-svg-g2s68iyJU0L4Apy3 .arrowheadPath{fill:#333333;}#mermaid-svg-g2s68iyJU0L4Apy3 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-g2s68iyJU0L4Apy3 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-g2s68iyJU0L4Apy3 .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-g2s68iyJU0L4Apy3 .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-g2s68iyJU0L4Apy3 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-g2s68iyJU0L4Apy3 .cluster text{fill:#333;}#mermaid-svg-g2s68iyJU0L4Apy3 .cluster span{color:#333;}#mermaid-svg-g2s68iyJU0L4Apy3 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-g2s68iyJU0L4Apy3 :root{&#8211;mermaid-font-family:\\&#8221;trebuchet ms\\&#8221;,verdana,arial,sans-serif;}<\/p>\n<p>         <span id=\"L-L-A-B\" class=\"edgeLabel L-LS-A&#039; L-LE-B\"><\/span><\/p>\n<p>         <span id=\"L-L-B-C\" class=\"edgeLabel L-LS-B&#039; L-LE-C\"><\/span><\/p>\n<p>         <span id=\"L-L-B-D\" class=\"edgeLabel L-LS-B&#039; L-LE-D\"><\/span><\/p>\n<p>         <span id=\"L-L-D-E\" class=\"edgeLabel L-LS-D&#039; L-LE-E\"><\/span><\/p>\n<p>         <span id=\"L-L-E-F\" class=\"edgeLabel L-LS-E&#039; L-LE-F\"><\/span><\/p>\n<p>         <span id=\"L-L-F-G\" class=\"edgeLabel L-LS-F&#039; L-LE-G\"><\/span><\/p>\n<p>          Server<\/p>\n<p>          Service<\/p>\n<p>          Connector<\/p>\n<p>          Engine<\/p>\n<p>          Host<\/p>\n<p>          Context<\/p>\n<p>          Wrapper<\/p>\n<ul>\n<li>Server&#xff1a;\u9876\u5c42\u5bb9\u5668&#xff0c;\u8868\u793a\u6574\u4e2aTomcat\u5b9e\u4f8b\u3002<\/li>\n<li>Service&#xff1a;\u670d\u52a1\u5c42&#xff0c;\u4e00\u4e2aService\u5305\u542b\u4e00\u7ec4Connector\u548c\u4e00\u4e2aEngine\u3002<\/li>\n<li>Connector&#xff1a;\u8d1f\u8d23\u63a5\u6536\u5ba2\u6237\u7aef\u8bf7\u6c42\u5e76\u8f6c\u53d1\u7ed9Engine&#xff08;\u5982HTTP\u3001AJP&#xff09;\u3002<\/li>\n<li>Engine&#xff1a;\u8bf7\u6c42\u5904\u7406\u5f15\u64ce&#xff0c;\u5206\u53d1\u8bf7\u6c42\u5230\u5bf9\u5e94Host\u3002<\/li>\n<li>Host&#xff1a;\u865a\u62df\u4e3b\u673a&#xff0c;\u5b9e\u73b0\u591a\u7ad9\u70b9\u90e8\u7f72\u3002<\/li>\n<li>Context&#xff1a;\u5355\u4e2aWeb\u5e94\u7528\u4e0a\u4e0b\u6587\u3002<\/li>\n<li>Wrapper&#xff1a;\u5355\u4e2aServlet\u5b9e\u4f8b\u7684\u5305\u88c5\u3002<\/li>\n<\/ul>\n<h4>2.2 \u4e3b\u6d41\u7a0b\u73af\u8282<\/h4>\n<li>\u521d\u59cb\u5316&#xff1a;Server\/Service\/Connector\/Engine\u7b49\u7ec4\u4ef6\u521d\u59cb\u5316\u4e0e\u88c5\u914d\u3002<\/li>\n<li>\u542f\u52a8&#xff1a;\u542f\u52a8\u8fde\u63a5\u5668\u76d1\u542c\u7aef\u53e3&#xff0c;\u51c6\u5907\u63a5\u6536\u8bf7\u6c42\u3002<\/li>\n<li>\u8bf7\u6c42\u63a5\u6536&#xff1a;Connector\u63a5\u6536\u8bf7\u6c42&#xff0c;\u5c01\u88c5\u4e3aRequest\u5bf9\u8c61\u3002<\/li>\n<li>\u8bf7\u6c42\u5206\u53d1&#xff1a;Engine\u6839\u636eHost\u3001Context\u3001Wrapper\u8def\u7531\u8bf7\u6c42\u3002<\/li>\n<li>Servlet\u5904\u7406&#xff1a;Servlet\u5904\u7406\u4e1a\u52a1\u903b\u8f91\u5e76\u8fd4\u56de\u54cd\u5e94\u3002<\/li>\n<li>\u5173\u95ed\u548c\u8d44\u6e90\u91ca\u653e\u3002<\/li>\n<hr \/>\n<h3>\u4e09\u3001\u4e3b\u6d41\u7a0b\u8bbe\u8ba1\u601d\u60f3\u4e0e\u5206\u6790<\/h3>\n<h4>3.1 \u5206\u5c42\u89e3\u8026\u4e0e\u804c\u8d23\u5206\u660e<\/h4>\n<ul>\n<li>\u8bbe\u8ba1\u601d\u60f3&#xff1a;\u901a\u8fc7Server-Service-Connector\/Engine-Host-Context-Wrapper\u591a\u5c42\u7ed3\u6784&#xff0c;\u5c06\u534f\u8bae\u63a5\u5165\u3001\u8bf7\u6c42\u8c03\u5ea6\u3001\u5e94\u7528\u5904\u7406\u7b49\u89e3\u8026&#xff0c;\u6613\u4e8e\u6269\u5c55\u4e0e\u7ef4\u62a4\u3002<\/li>\n<li>\u4f18\u70b9&#xff1a;\u6a21\u5757\u5316\u3001\u53ef\u63d2\u62d4\u3001\u652f\u6301\u591a\u534f\u8bae\/\u591a\u7ad9\u70b9\/\u591a\u5e94\u7528\u3002<\/li>\n<li>\u7f3a\u70b9&#xff1a;\u7ed3\u6784\u590d\u6742&#xff0c;\u8c03\u8bd5\u5b9a\u4f4d\u9700\u7406\u89e3\u5168\u94fe\u8def\u3002<\/li>\n<\/ul>\n<h4>3.2 \u4e8b\u4ef6\u9a71\u52a8\u4e0e\u5f02\u6b65I\/O<\/h4>\n<ul>\n<li>\u8bbe\u8ba1\u601d\u60f3&#xff1a;Connector&#xff08;\u5982NIO&#xff09;\u91c7\u7528\u4e8b\u4ef6\u9a71\u52a8\u6a21\u578b&#xff0c;\u63d0\u5347\u5e76\u53d1\u6027\u80fd\u3002<\/li>\n<li>\u4f18\u70b9&#xff1a;\u9ad8\u5e76\u53d1\u3001\u8d44\u6e90\u5360\u7528\u4f4e\u3002<\/li>\n<li>\u7f3a\u70b9&#xff1a;\u5b9e\u73b0\u4e0e\u6392\u67e5\u96be\u5ea6\u63d0\u5347\u3002<\/li>\n<\/ul>\n<h4>3.3 \u751f\u547d\u5468\u671f\u63a7\u5236<\/h4>\n<ul>\n<li>\u8bbe\u8ba1\u6280\u5de7&#xff1a;\u6240\u6709\u7ec4\u4ef6\u5b9e\u73b0Lifecycle\u63a5\u53e3&#xff0c;\u652f\u6301\u7edf\u4e00\u7684init\u3001start\u3001stop\u3001destroy\u7ba1\u7406\u3002<\/li>\n<li>\u4f18\u70b9&#xff1a;\u6613\u4e8e\u70ed\u90e8\u7f72\u4e0e\u5e73\u6ed1\u91cd\u542f\u3002<\/li>\n<li>\u7f3a\u70b9&#xff1a;\u751f\u547d\u5468\u671f\u4f9d\u8d56\u94fe\u590d\u6742\u3002<\/li>\n<\/ul>\n<h5>\u901f\u8bb0\u53e3\u8bc0<\/h5>\n<p>\u201c\u5206\u5c42\u89e3\u8026&#xff0c;\u4e8b\u4ef6\u9a71\u52a8&#xff0c;\u751f\u547d\u5468\u671f\u7edf\u4e00\u7ba1\u3002\u201d<\/p>\n<hr \/>\n<h3>\u56db\u3001\u6838\u5fc3\u6e90\u7801\u5256\u6790<\/h3>\n<h4>4.1 Server\u542f\u52a8\u4e3b\u6d41\u7a0b<\/h4>\n<p>\u542f\u52a8\u5165\u53e3&#xff1a;org.apache.catalina.startup.Bootstrap<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Bootstrap<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">static<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">main<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> args<span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">throws<\/span> <span class=\"token class-name\">Exception<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">Bootstrap<\/span> bootstrap <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Bootstrap<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        bootstrap<span class=\"token punctuation\">.<\/span><span class=\"token function\">init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>   <span class=\"token comment\">\/\/ \u521d\u59cb\u5316<\/span><br \/>\n        bootstrap<span class=\"token punctuation\">.<\/span><span class=\"token function\">start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">\/\/ \u542f\u52a8<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h5>\u5173\u952e\u65b9\u6cd5\u8be6\u89e3<\/h5>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">throws<\/span> <span class=\"token class-name\">Exception<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u53cd\u5c04\u8c03\u7528Catalina\u7684start\u65b9\u6cd5<\/span><br \/>\n    <span class=\"token class-name\">Method<\/span> method <span class=\"token operator\">&#061;<\/span> catalinaDaemon<span class=\"token punctuation\">.<\/span><span class=\"token function\">getClass<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getMethod<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;start&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Class<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    method<span class=\"token punctuation\">.<\/span><span class=\"token function\">invoke<\/span><span class=\"token punctuation\">(<\/span>catalinaDaemon<span class=\"token punctuation\">,<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Object<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>Catalina\u6838\u5fc3\u542f\u52a8\u6d41\u7a0b&#xff08;\u7cbe\u7b80\u7248&#xff09;&#xff1a;<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">load<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ 1. \u89e3\u6790server.xml&#xff0c;\u6784\u5efaServer\/Service\/Connector\u7b49\u5bf9\u8c61<\/span><br \/>\n    <span class=\"token class-name\">Digester<\/span> digester <span class=\"token operator\">&#061;<\/span> <span class=\"token function\">createStartDigester<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token comment\">\/\/ 2. \u89e3\u6790\u914d\u7f6e\u6587\u4ef6<\/span><br \/>\n    digester<span class=\"token punctuation\">.<\/span><span class=\"token function\">parse<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">new<\/span> <span class=\"token class-name\">FileInputStream<\/span><span class=\"token punctuation\">(<\/span>configFile<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token comment\">\/\/ 3. \u8c03\u7528Server.init()<\/span><br \/>\n    server<span class=\"token punctuation\">.<\/span><span class=\"token function\">init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ 1. \u8c03\u7528Server.start()<\/span><br \/>\n    server<span class=\"token punctuation\">.<\/span><span class=\"token function\">start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h5>Server\/Service\/Connector\/Engine\u521d\u59cb\u5316\u6d41\u7a0b<\/h5>\n<p><span class=\"token comment\">\/\/ Server.java<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">throws<\/span> <span class=\"token class-name\">LifecycleException<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Service<\/span> service <span class=\"token operator\">:<\/span> services<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        service<span class=\"token punctuation\">.<\/span><span class=\"token function\">init<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">throws<\/span> <span class=\"token class-name\">LifecycleException<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Service<\/span> service <span class=\"token operator\">:<\/span> services<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        service<span class=\"token punctuation\">.<\/span><span class=\"token function\">start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u9010\u884c\u6ce8\u91ca\u901f\u8bb0&#xff1a;<\/p>\n<ul>\n<li>\u5148\u89e3\u6790\u914d\u7f6e&#xff0c;\u6784\u5efa\u5bf9\u8c61\u6811\u3002<\/li>\n<li>\u518d\u9012\u5f52\u521d\u59cb\u5316\u3001\u542f\u52a8\u6240\u6709\u7ec4\u4ef6\u3002<\/li>\n<\/ul>\n<p>\u53e3\u8bc0&#xff1a;\u201c\u5148\u914d\u7f6e&#xff0c;\u540e\u88c5\u914d&#xff1b;\u9012\u5f52\u542f\u505c&#xff0c;\u751f\u547d\u5468\u671f\u5168\u94fe\u8def\u3002\u201d<\/p>\n<hr \/>\n<h4>4.2 Connector\u8bf7\u6c42\u63a5\u6536<\/h4>\n<p>\u6838\u5fc3\u7c7b&#xff1a;org.apache.coyote.AbstractProtocol<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token keyword\">throws<\/span> <span class=\"token class-name\">Exception<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u521b\u5efaAcceptor\u7ebf\u7a0b\u76d1\u542c\u7aef\u53e3<\/span><br \/>\n    <span class=\"token function\">startAcceptorThreads<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token keyword\">protected<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">startAcceptorThreads<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ \u542f\u52a8\u4e00\u4e2a\u6216\u591a\u4e2aAcceptor\u7ebf\u7a0b<\/span><br \/>\n    <span class=\"token keyword\">for<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token keyword\">int<\/span> i <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">;<\/span> i <span class=\"token operator\">&lt;<\/span> acceptorThreadCount<span class=\"token punctuation\">;<\/span> i<span class=\"token operator\">&#043;&#043;<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">Thread<\/span> acceptorThread <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Thread<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Acceptor<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;Acceptor-&#034;<\/span> <span class=\"token operator\">&#043;<\/span> i<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        acceptorThread<span class=\"token punctuation\">.<\/span><span class=\"token function\">start<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>Acceptor\u4e3b\u6d41\u7a0b&#xff1a;<\/p>\n<p><span class=\"token keyword\">private<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">Acceptor<\/span> <span class=\"token keyword\">implements<\/span> <span class=\"token class-name\">Runnable<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">run<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token keyword\">while<\/span> <span class=\"token punctuation\">(<\/span>running<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token comment\">\/\/ 1. \u963b\u585e\u7b49\u5f85socket\u8fde\u63a5<\/span><br \/>\n            <span class=\"token class-name\">Socket<\/span> socket <span class=\"token operator\">&#061;<\/span> serverSocket<span class=\"token punctuation\">.<\/span><span class=\"token function\">accept<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token comment\">\/\/ 2. \u5c01\u88c5\u4e3a\u8bf7\u6c42\u5bf9\u8c61<\/span><br \/>\n            <span class=\"token comment\">\/\/ 3. \u6295\u9012\u5230\u5de5\u4f5c\u7ebf\u7a0b\u6c60\u5904\u7406<\/span><br \/>\n            <span class=\"token function\">processSocket<\/span><span class=\"token punctuation\">(<\/span>socket<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u53e3\u8bc0&#xff1a;\u201cAcceptor\u76d1\u542c&#xff0c;Socket\u6765&#xff0c;\u7ebf\u7a0b\u6c60\u5904\u7406\u3002\u201d<\/p>\n<hr \/>\n<h4>4.3 \u8bf7\u6c42\u5206\u53d1\u6d41\u7a0b<\/h4>\n<p>\u6838\u5fc3\u7c7b&#xff1a;org.apache.catalina.core.StandardEngineValve<\/p>\n<p><span class=\"token keyword\">public<\/span> <span class=\"token keyword\">final<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">invoke<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Request<\/span> request<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">Response<\/span> response<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token comment\">\/\/ 1. \u6839\u636eHost\u8def\u7531<\/span><br \/>\n    <span class=\"token class-name\">Host<\/span> host <span class=\"token operator\">&#061;<\/span> request<span class=\"token punctuation\">.<\/span><span class=\"token function\">getHost<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token comment\">\/\/ 2. \u6839\u636eContext\u8def\u7531<\/span><br \/>\n    <span class=\"token class-name\">Context<\/span> context <span class=\"token operator\">&#061;<\/span> host<span class=\"token punctuation\">.<\/span><span class=\"token function\">map<\/span><span class=\"token punctuation\">(<\/span>request<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token comment\">\/\/ 3. \u6839\u636eWrapper\u8def\u7531<\/span><br \/>\n    <span class=\"token class-name\">Wrapper<\/span> wrapper <span class=\"token operator\">&#061;<\/span> context<span class=\"token punctuation\">.<\/span><span class=\"token function\">map<\/span><span class=\"token punctuation\">(<\/span>request<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token comment\">\/\/ 4. \u8c03\u7528Servlet\u5904\u7406<\/span><br \/>\n    wrapper<span class=\"token punctuation\">.<\/span><span class=\"token function\">invoke<\/span><span class=\"token punctuation\">(<\/span>request<span class=\"token punctuation\">,<\/span> response<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p>\u53e3\u8bc0&#xff1a;\u201c\u4e3b\u673a\u627e\u7ad9\u70b9&#xff0c;\u7ad9\u70b9\u627e\u5e94\u7528&#xff0c;\u5e94\u7528\u627eServlet\u3002\u201d<\/p>\n<hr \/>\n<h3>\u4e94\u3001\u5b9e\u9645\u4e1a\u52a1\u573a\u666f\u4e3e\u4f8b\u4e0e\u8c03\u8bd5\u4f18\u5316<\/h3>\n<h4>5.1 \u591a\u7ad9\u70b9\u90e8\u7f72<\/h4>\n<ul>\n<li>\u573a\u666f&#xff1a;\u4e00\u53f0Tomcat\u90e8\u7f72\u591a\u4e2a\u57df\u540d\u7ad9\u70b9\u3002<\/li>\n<li>\u6280\u5de7&#xff1a;\u914d\u7f6e\u591a\u4e2aHost&#xff0c;Context\u9694\u79bb\u5e94\u7528&#xff0c;\u4fbf\u4e8e\u7070\u5ea6\u53d1\u5e03\u548c\u591a\u79df\u6237\u8fd0\u8425\u3002<\/li>\n<\/ul>\n<h4>5.2 \u7aef\u53e3\u4e0e\u534f\u8bae\u6269\u5c55<\/h4>\n<ul>\n<li>\u573a\u666f&#xff1a;\u540c\u65f6\u652f\u6301HTTP\u548cAJP\u3002<\/li>\n<li>\u6280\u5de7&#xff1a;\u914d\u7f6e\u591a\u4e2aConnector&#xff0c;\u5b9e\u73b0\u534f\u8bae\u517c\u5bb9\u4e0e\u8d1f\u8f7d\u5747\u8861\u3002<\/li>\n<\/ul>\n<h4>5.3 \u6027\u80fd\u4f18\u5316<\/h4>\n<ul>\n<li>\u7ebf\u7a0b\u6c60\u53c2\u6570&#xff1a;\u8c03\u4f18Connector\u7684maxThreads\u3001acceptCount\u7b49\u3002<\/li>\n<li>NIO\u4e0eAPR&#xff1a;\u6839\u636eQPS\u9009\u62e9NIO\/NIO2\/APR\u534f\u8bae\u6808\u3002<\/li>\n<li>JVM\u8c03\u4f18&#xff1a;\u7ed3\u5408GC\u3001\u5806\u6808\u53c2\u6570\u63d0\u5347\u541e\u5410\u3002<\/li>\n<\/ul>\n<h4>5.4 \u8c03\u8bd5\u6392\u67e5<\/h4>\n<ul>\n<li>\u542f\u52a8\u5931\u8d25&#xff1a;\u68c0\u67e5server.xml\u7aef\u53e3\u51b2\u7a81\u3001\u6743\u9650\u95ee\u9898\u3002<\/li>\n<li>\u8bf7\u6c42\u5361\u6b7b&#xff1a;JVisualVM\u5206\u6790\u7ebf\u7a0b\u6c60\u4e0e\u7b49\u5f85\u961f\u5217\u3002<\/li>\n<li>\u6162\u8bf7\u6c42\u8ffd\u8e2a&#xff1a;\u5f00\u542fTomcat Access Log&#xff0c;\u7ed3\u5408AOP\u57cb\u70b9\u5b9a\u4f4d\u74f6\u9888\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>\u516d\u3001\u4e0e\u5176\u4ed6\u6280\u672f\u6808\u7684\u96c6\u6210\u4e0e\u9ad8\u9636\u5e94\u7528<\/h3>\n<h4>6.1 \u96c6\u6210Spring Boot<\/h4>\n<ul>\n<li>\u539f\u7406&#xff1a;Spring Boot\u5185\u5d4cTomcat&#xff0c;\u52a8\u6001\u88c5\u914dServlet\u548cFilter&#xff0c;\u7b80\u5316\u90e8\u7f72\u3002<\/li>\n<li>\u6280\u5de7&#xff1a;\u81ea\u5b9a\u4e49Servlet\/Filter\/Listener\u65f6&#xff0c;\u6ce8\u610f\u751f\u547d\u5468\u671f\u4e0eTomcat\u4fdd\u6301\u4e00\u81f4\u3002<\/li>\n<\/ul>\n<h4>6.2 \u5bb9\u5668\u5316\u4e0e\u4e91\u539f\u751f<\/h4>\n<ul>\n<li>Docker\/K8s&#xff1a;Tomcat\u4ee5\u955c\u50cf\u65b9\u5f0f\u90e8\u7f72&#xff0c;\u7ed3\u5408\u5065\u5eb7\u68c0\u67e5\u3001\u81ea\u52a8\u6269\u7f29\u5bb9\u3002<\/li>\n<li>Service Mesh&#xff1a;\u901a\u8fc7Istio\u7b49\u5b9e\u73b0\u6d41\u91cf\u6cbb\u7406&#xff0c;Tomcat\u4e13\u6ce8\u4e8e\u4e1a\u52a1\u5904\u7406\u3002<\/li>\n<\/ul>\n<h4>6.3 \u63d2\u4ef6\u4e0e\u6269\u5c55<\/h4>\n<ul>\n<li>\u81ea\u5b9a\u4e49Valve\/Filter&#xff1a;\u5b9e\u73b0\u5b89\u5168\u5ba1\u8ba1\u3001\u9650\u6d41\u7b49\u529f\u80fd\u3002<\/li>\n<li>\u53cd\u5411\u4ee3\u7406&#xff1a;\u4e0eNginx\/Apache\u96c6\u6210&#xff0c;\u5b9e\u73b0SSL\u3001\u8d1f\u8f7d\u5747\u8861\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e03\u3001\u5e95\u5c42\u5b9e\u73b0\u3001\u9ad8\u7ea7\u7b97\u6cd5\u4e0e\u67b6\u6784\u6f14\u8fdb<\/h3>\n<h4>7.1 I\/O\u6a21\u578b\u6f14\u8fdb<\/h4>\n<ul>\n<li>BIO&#xff1a;\u6bcf\u8fde\u63a5\u4e00\u7ebf\u7a0b&#xff0c;\u9002\u5408\u4f4e\u5e76\u53d1\u3002<\/li>\n<li>NIO\/NIO2&#xff1a;\u57fa\u4e8eSelector\u4e8b\u4ef6\u9a71\u52a8&#xff0c;\u5927\u5e45\u63d0\u5347\u5e76\u53d1\u80fd\u529b&#xff0c;\u9ed8\u8ba4\u63a8\u8350\u3002<\/li>\n<li>APR&#xff1a;\u8c03\u7528\u672c\u5730\u5e93&#xff0c;\u6027\u80fd\u6700\u4f18&#xff0c;\u4f46\u90e8\u7f72\u590d\u6742\u3002<\/li>\n<\/ul>\n<h4>7.2 \u7ebf\u7a0b\u6c60\u4e0e\u4efb\u52a1\u8c03\u5ea6<\/h4>\n<ul>\n<li>Executor&#xff1a;\u53ef\u81ea\u5b9a\u4e49\u7ebf\u7a0b\u6c60\u53c2\u6570&#xff0c;\u652f\u6301\u62d2\u7edd\u7b56\u7565\u3002<\/li>\n<li>\u5f02\u6b65Servlet&#xff1a;Servlet 3.0\u652f\u6301\u5f02\u6b65\u5904\u7406&#xff0c;\u63d0\u5347\u541e\u5410\u3002<\/li>\n<\/ul>\n<h4>7.3 \u67b6\u6784\u6f14\u8fdb<\/h4>\n<ul>\n<li>\u5355\u4f53&#xff1a;\u65e9\u671f\u5355\u4e00Engine\/Host\/Context\u3002<\/li>\n<li>\u591a\u79df\u6237&#xff1a;\u591aHost\/Context\u9694\u79bb\u3002<\/li>\n<li>\u4e91\u539f\u751f&#xff1a;\u670d\u52a1\u5316\u3001\u65e0\u72b6\u6001\u3001\u81ea\u52a8\u4f38\u7f29\u3002<\/li>\n<\/ul>\n<hr \/>\n<h3>\u516b\u3001\u6743\u5a01\u8d44\u6599\u4e0e\u53c2\u8003\u6587\u732e<\/h3>\n<ul>\n<li>Tomcat\u5b98\u65b9\u6587\u6863<\/li>\n<li>Tomcat\u67b6\u6784\u5206\u6790\u7cfb\u5217<\/li>\n<li>Spring Boot\u5b98\u65b9\u6587\u6863<\/li>\n<li>\u300aJava\u9ad8\u5e76\u53d1\u7f16\u7a0b\u8be6\u89e3\u300b<\/li>\n<\/ul>\n<hr \/>\n<h3>\u4e5d\u3001\u603b\u7ed3\u4e0e\u7cfb\u7edf\u8ba4\u77e5<\/h3>\n<p>Tomcat Server\u901a\u8fc7\u5206\u5c42\u89e3\u8026\u3001\u4e8b\u4ef6\u9a71\u52a8\u3001\u7edf\u4e00\u751f\u547d\u5468\u671f\u7ba1\u7406&#xff0c;\u652f\u6491\u4e86\u9ad8\u5e76\u53d1\u3001\u9ad8\u53ef\u7528\u7684Java Web\u670d\u52a1\u3002\u638c\u63e1\u5176\u4e3b\u6d41\u7a0b\u3001\u6e90\u7801\u7ec6\u8282\u3001\u8c03\u4f18\u6280\u5de7\u3001\u96c6\u6210\u6a21\u5f0f\u53ca\u67b6\u6784\u6f14\u8fdb&#xff0c;\u6709\u52a9\u4e8e\u5728\u5b9e\u9645\u751f\u4ea7\u4e2d\u9ad8\u6548\u5b9a\u4f4d\u4e0e\u89e3\u51b3\u95ee\u9898&#xff0c;\u5e76\u4e3a\u4e91\u539f\u751f\u3001\u5fae\u670d\u52a1\u7b49\u9ad8\u9636\u5e94\u7528\u6253\u4e0b\u575a\u5b9e\u57fa\u7840\u3002<\/p>\n<hr \/>\n<p>\u5168\u6d41\u7a0b\u901f\u8bb0\u53e3\u8bc0&#xff1a;<\/p>\n<ul>\n<li>\u5206\u5c42\u89e3\u8026&#xff0c;\u4e8b\u4ef6\u9a71\u52a8&#xff0c;\u751f\u547d\u5468\u671f\u7edf\u4e00\u7ba1\u3002<\/li>\n<li>\u5148\u914d\u7f6e&#xff0c;\u540e\u88c5\u914d&#xff1b;\u9012\u5f52\u542f\u505c&#xff0c;\u751f\u547d\u5468\u671f\u5168\u94fe\u8def\u3002<\/li>\n<li>Acceptor\u76d1\u542c&#xff0c;Socket\u6765&#xff0c;\u7ebf\u7a0b\u6c60\u5904\u7406\u3002<\/li>\n<li>\u4e3b\u673a\u627e\u7ad9\u70b9&#xff0c;\u7ad9\u70b9\u627e\u5e94\u7528&#xff0c;\u5e94\u7528\u627eServlet\u3002<\/li>\n<\/ul>\n<hr \/>\n<p>\u5982\u6709\u7591\u95ee&#xff0c;\u6b22\u8fce\u7559\u8a00\u4ea4\u6d41&#xff01;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.3k\u6b21\uff0c\u70b9\u8d5e41\u6b21\uff0c\u6536\u85cf45\u6b21\u3002Tomcat Server\u901a\u8fc7\u5206\u5c42\u89e3\u8026\u3001\u4e8b\u4ef6\u9a71\u52a8\u3001\u7edf\u4e00\u751f\u547d\u5468\u671f\u7ba1\u7406\uff0c\u652f\u6491\u4e86\u9ad8\u5e76\u53d1\u3001\u9ad8\u53ef\u7528\u7684Java Web\u670d\u52a1\u3002\u638c\u63e1\u5176\u4e3b\u6d41\u7a0b\u3001\u6e90\u7801\u7ec6\u8282\u3001\u8c03\u4f18\u6280\u5de7\u3001\u96c6\u6210\u6a21\u5f0f\u53ca\u67b6\u6784\u6f14\u8fdb\uff0c\u6709\u52a9\u4e8e\u5728\u5b9e\u9645\u751f\u4ea7\u4e2d\u9ad8\u6548\u5b9a\u4f4d\u4e0e\u89e3\u51b3\u95ee\u9898\uff0c\u5e76\u4e3a\u4e91\u539f\u751f\u3001\u5fae\u670d\u52a1\u7b49\u9ad8\u9636\u5e94\u7528\u6253\u4e0b\u575a\u5b9e\u57fa\u7840\u3002\u5206\u5c42\u89e3\u8026\uff0c\u4e8b\u4ef6\u9a71\u52a8\uff0c\u751f\u547d\u5468\u671f\u7edf\u4e00\u7ba1\u3002\u5148\u914d\u7f6e\uff0c\u540e\u88c5\u914d\uff1b\u9012\u5f52\u542f\u505c\uff0c\u751f\u547d\u5468\u671f\u5168\u94fe\u8def\u3002Acceptor\u76d1\u542c\uff0cSocket\u6765\uff0c\u7ebf\u7a0b\u6c60\u5904\u7406\u3002\u4e3b\u673a\u627e\u7ad9\u70b9\uff0c\u7ad9\u70b9\u627e\u5e94\u7528\uff0c\u5e94\u7528\u627eServlet\u3002\u5982\u6709\u7591\u95ee\uff0c\u6b22\u8fce\u7559\u8a00\u4ea4\u6d41\uff01<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[223,43],"topic":[],"class_list":["post-48645","post","type-post","status-publish","format-standard","hentry","category-server","tag-tomcat","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u6df1\u5165\u7406\u89e3Tomcat Server\u670d\u52a1\u5668\u539f\u7406 - \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\/48645.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u6df1\u5165\u7406\u89e3Tomcat Server\u670d\u52a1\u5668\u539f\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.3k\u6b21\uff0c\u70b9\u8d5e41\u6b21\uff0c\u6536\u85cf45\u6b21\u3002Tomcat Server\u901a\u8fc7\u5206\u5c42\u89e3\u8026\u3001\u4e8b\u4ef6\u9a71\u52a8\u3001\u7edf\u4e00\u751f\u547d\u5468\u671f\u7ba1\u7406\uff0c\u652f\u6491\u4e86\u9ad8\u5e76\u53d1\u3001\u9ad8\u53ef\u7528\u7684Java Web\u670d\u52a1\u3002\u638c\u63e1\u5176\u4e3b\u6d41\u7a0b\u3001\u6e90\u7801\u7ec6\u8282\u3001\u8c03\u4f18\u6280\u5de7\u3001\u96c6\u6210\u6a21\u5f0f\u53ca\u67b6\u6784\u6f14\u8fdb\uff0c\u6709\u52a9\u4e8e\u5728\u5b9e\u9645\u751f\u4ea7\u4e2d\u9ad8\u6548\u5b9a\u4f4d\u4e0e\u89e3\u51b3\u95ee\u9898\uff0c\u5e76\u4e3a\u4e91\u539f\u751f\u3001\u5fae\u670d\u52a1\u7b49\u9ad8\u9636\u5e94\u7528\u6253\u4e0b\u575a\u5b9e\u57fa\u7840\u3002\u5206\u5c42\u89e3\u8026\uff0c\u4e8b\u4ef6\u9a71\u52a8\uff0c\u751f\u547d\u5468\u671f\u7edf\u4e00\u7ba1\u3002\u5148\u914d\u7f6e\uff0c\u540e\u88c5\u914d\uff1b\u9012\u5f52\u542f\u505c\uff0c\u751f\u547d\u5468\u671f\u5168\u94fe\u8def\u3002Acceptor\u76d1\u542c\uff0cSocket\u6765\uff0c\u7ebf\u7a0b\u6c60\u5904\u7406\u3002\u4e3b\u673a\u627e\u7ad9\u70b9\uff0c\u7ad9\u70b9\u627e\u5e94\u7528\uff0c\u5e94\u7528\u627eServlet\u3002\u5982\u6709\u7591\u95ee\uff0c\u6b22\u8fce\u7559\u8a00\u4ea4\u6d41\uff01\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/48645.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-30T04:53:20+00:00\" \/>\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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/48645.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/48645.html\",\"name\":\"\u6df1\u5165\u7406\u89e3Tomcat Server\u670d\u52a1\u5668\u539f\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-30T04:53:20+00:00\",\"dateModified\":\"2025-07-30T04:53:20+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/48645.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/48645.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/48645.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u6df1\u5165\u7406\u89e3Tomcat Server\u670d\u52a1\u5668\u539f\u7406\"}]},{\"@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":"\u6df1\u5165\u7406\u89e3Tomcat Server\u670d\u52a1\u5668\u539f\u7406 - \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\/48645.html","og_locale":"zh_CN","og_type":"article","og_title":"\u6df1\u5165\u7406\u89e3Tomcat Server\u670d\u52a1\u5668\u539f\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.3k\u6b21\uff0c\u70b9\u8d5e41\u6b21\uff0c\u6536\u85cf45\u6b21\u3002Tomcat Server\u901a\u8fc7\u5206\u5c42\u89e3\u8026\u3001\u4e8b\u4ef6\u9a71\u52a8\u3001\u7edf\u4e00\u751f\u547d\u5468\u671f\u7ba1\u7406\uff0c\u652f\u6491\u4e86\u9ad8\u5e76\u53d1\u3001\u9ad8\u53ef\u7528\u7684Java Web\u670d\u52a1\u3002\u638c\u63e1\u5176\u4e3b\u6d41\u7a0b\u3001\u6e90\u7801\u7ec6\u8282\u3001\u8c03\u4f18\u6280\u5de7\u3001\u96c6\u6210\u6a21\u5f0f\u53ca\u67b6\u6784\u6f14\u8fdb\uff0c\u6709\u52a9\u4e8e\u5728\u5b9e\u9645\u751f\u4ea7\u4e2d\u9ad8\u6548\u5b9a\u4f4d\u4e0e\u89e3\u51b3\u95ee\u9898\uff0c\u5e76\u4e3a\u4e91\u539f\u751f\u3001\u5fae\u670d\u52a1\u7b49\u9ad8\u9636\u5e94\u7528\u6253\u4e0b\u575a\u5b9e\u57fa\u7840\u3002\u5206\u5c42\u89e3\u8026\uff0c\u4e8b\u4ef6\u9a71\u52a8\uff0c\u751f\u547d\u5468\u671f\u7edf\u4e00\u7ba1\u3002\u5148\u914d\u7f6e\uff0c\u540e\u88c5\u914d\uff1b\u9012\u5f52\u542f\u505c\uff0c\u751f\u547d\u5468\u671f\u5168\u94fe\u8def\u3002Acceptor\u76d1\u542c\uff0cSocket\u6765\uff0c\u7ebf\u7a0b\u6c60\u5904\u7406\u3002\u4e3b\u673a\u627e\u7ad9\u70b9\uff0c\u7ad9\u70b9\u627e\u5e94\u7528\uff0c\u5e94\u7528\u627eServlet\u3002\u5982\u6709\u7591\u95ee\uff0c\u6b22\u8fce\u7559\u8a00\u4ea4\u6d41\uff01","og_url":"https:\/\/www.wsisp.com\/helps\/48645.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-30T04:53:20+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/48645.html","url":"https:\/\/www.wsisp.com\/helps\/48645.html","name":"\u6df1\u5165\u7406\u89e3Tomcat Server\u670d\u52a1\u5668\u539f\u7406 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-30T04:53:20+00:00","dateModified":"2025-07-30T04:53:20+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/48645.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/48645.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/48645.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u6df1\u5165\u7406\u89e3Tomcat Server\u670d\u52a1\u5668\u539f\u7406"}]},{"@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\/48645","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=48645"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/48645\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=48645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=48645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=48645"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=48645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}