{"id":37364,"date":"2025-05-15T22:27:38","date_gmt":"2025-05-15T14:27:38","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/37364.html"},"modified":"2025-05-15T22:27:38","modified_gmt":"2025-05-15T14:27:38","slug":"tomcat%e4%b8%8e%e7%ba%af-java-socket-%e5%ae%9e%e7%8e%b0%e8%bf%9c%e7%a8%8b%e9%80%9a%e4%bf%a1%e7%9a%84%e5%8c%ba%e5%88%ab","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/37364.html","title":{"rendered":"Tomcat\u4e0e\u7eaf Java Socket \u5b9e\u73b0\u8fdc\u7a0b\u901a\u4fe1\u7684\u533a\u522b"},"content":{"rendered":"<h3>Servlet \u5bb9\u5668\u200b\u200b&#xff08;\u5982 Tomcat&#xff09;<\/h3>\n<p>\u662f\u4e00\u4e2a\u7ba1\u7406 Servlet \u751f\u547d\u5468\u671f\u7684\u8fd0\u884c\u73af\u5883&#xff0c;\u4e3b\u8981\u529f\u80fd\u5305\u62ec&#xff1a;<\/p>\n<p>\u200b\u200b\u534f\u8bae\u89e3\u6790\u200b\u200b&#xff1a;\u81ea\u52a8\u5904\u7406 HTTP \u8bf7\u6c42\/\u54cd\u5e94\u7684\u5e95\u5c42\u534f\u8bae&#xff08;\u5982\u62a5\u6587\u5934\u89e3\u6790\u3001\u72b6\u6001\u7801\u751f\u6210&#xff09;&#xff1b; \u200b\u200b\u7ebf\u7a0b\u6c60\u7ba1\u7406\u200b\u200b&#xff1a;\u901a\u8fc7\u5185\u7f6e\u7ebf\u7a0b\u6c60\u5904\u7406\u9ad8\u5e76\u53d1\u8bf7\u6c42&#xff0c;\u5f00\u53d1\u8005\u65e0\u9700\u624b\u52a8\u7ba1\u7406\u591a\u7ebf\u7a0b&#xff1b; \u200b\u200b\u751f\u547d\u5468\u671f\u63a7\u5236\u200b\u200b&#xff1a;\u81ea\u52a8\u8c03\u7528 Servlet \u7684 init()\u3001service()\u3001destroy() \u65b9\u6cd5&#xff1b; \u200b\u200b\u8d44\u6e90\u5c01\u88c5\u200b\u200b&#xff1a;\u5c06\u539f\u59cb HTTP \u8bf7\u6c42\u5c01\u88c5\u4e3a HttpServletRequest \u5bf9\u8c61&#xff0c;\u7b80\u5316\u5f00\u53d1\u8005\u64cd\u4f5c\u3002<\/p>\n<p>\u9700\u8981 Tomcat \u7684\u4e3b\u8981\u539f\u56e0\u662f\u5176\u4f5c\u4e3a \u200b\u200bWeb \u5e94\u7528\u670d\u52a1\u5668\u200b\u200b\u548c \u200b\u200bServlet \u5bb9\u5668\u200b\u200b\u7684\u6838\u5fc3\u80fd\u529b&#xff0c;\u800c\u4e0d\u4ec5\u4ec5\u662f\u8fdb\u7a0b\u95f4\u901a\u4fe1&#xff08;IPC&#xff09;\u5de5\u5177\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u539f\u56e0\u548c\u4e24\u8005\u7684\u672c\u8d28\u533a\u522b&#xff1a;<\/p>\n<p>\u4e00\u3001Tomcat \u7684\u6838\u5fc3\u529f\u80fd&#xff1a;Web \u5e94\u7528\u670d\u52a1\u5668\u4e0e Servlet \u5bb9\u5668 \u200b\u200b\u534f\u8bae\u89e3\u6790\u4e0e HTTP \u670d\u52a1\u200b\u200b Tomcat \u7684\u6838\u5fc3\u804c\u8d23\u662f\u5904\u7406 \u200b\u200bHTTP \u534f\u8bae\u200b\u200b\u7684\u89e3\u6790\u4e0e\u54cd\u5e94&#xff0c;\u5305\u62ec\u8bf7\u6c42\u5934\u89e3\u6790\u3001\u54cd\u5e94\u751f\u6210\u3001\u72b6\u6001\u7801\u7ba1\u7406\u3001SSL\/TLS \u52a0\u5bc6\u7b49\u3002\u8fd9\u4e9b\u529f\u80fd\u9700\u8981\u590d\u6742\u7684\u534f\u8bae\u5b9e\u73b0&#xff0c;\u800c\u666e\u901a\u7684\u8fdb\u7a0b\u95f4\u901a\u4fe1&#xff08;\u5982 Socket&#xff09;\u4ec5\u80fd\u4f20\u8f93\u539f\u59cb\u6570\u636e&#xff0c;\u65e0\u6cd5\u76f4\u63a5\u5904\u7406 HTTP \u534f\u8bae\u89c4\u8303\u3002 \u200b\u200bServlet \u751f\u547d\u5468\u671f\u7ba1\u7406\u200b\u200b Tomcat \u4f5c\u4e3a Servlet \u5bb9\u5668&#xff0c;\u8d1f\u8d23\u7ba1\u7406 Servlet \u7684\u521d\u59cb\u5316\u3001\u8bf7\u6c42\u5904\u7406\u3001\u9500\u6bc1\u7b49\u751f\u547d\u5468\u671f\u3002\u4f8b\u5982&#xff0c;\u5f53\u7528\u6237\u8bf7\u6c42\u5230\u8fbe\u65f6&#xff0c;Tomcat \u4f1a\u5c06 HTTP \u8bf7\u6c42\u5c01\u88c5\u4e3a HttpServletRequest \u5bf9\u8c61&#xff0c;\u5e76\u8c03\u7528\u5bf9\u5e94\u7684 doGet() \u6216 doPost() \u65b9\u6cd5&#xff0c;\u5f00\u53d1\u8005\u7684\u4ee3\u7801\u53ea\u9700\u5173\u6ce8\u4e1a\u52a1\u903b\u8f91&#xff0c;\u65e0\u9700\u5904\u7406\u5e95\u5c42\u901a\u4fe1\u7ec6\u8282\u3002 \u200b\u200b\u7ebf\u7a0b\u6c60\u4e0e\u5e76\u53d1\u63a7\u5236\u200b\u200b Tomcat \u5185\u7f6e\u7ebf\u7a0b\u6c60&#xff0c;\u80fd\u9ad8\u6548\u5904\u7406\u9ad8\u5e76\u53d1\u8bf7\u6c42\u3002\u6bcf\u4e2a\u8bf7\u6c42\u4f1a\u88ab\u5206\u914d\u5230\u72ec\u7acb\u7684\u7ebf\u7a0b&#xff0c;\u800c\u666e\u901a\u8fdb\u7a0b\u95f4\u901a\u4fe1&#xff08;\u5982 Socket&#xff09;\u9700\u8981\u5f00\u53d1\u8005\u81ea\u884c\u5b9e\u73b0\u7ebf\u7a0b\u7ba1\u7406\u3001\u8d44\u6e90\u540c\u6b65\u7b49\u590d\u6742\u903b\u8f91\u3002 \u200b\u200b\u4f1a\u8bdd\u7ba1\u7406\u4e0e\u72b6\u6001\u4fdd\u6301\u200b\u200b Tomcat \u652f\u6301 HTTP \u4f1a\u8bdd&#xff08;Session&#xff09;\u7ba1\u7406&#xff0c;\u901a\u8fc7 Cookie \u6216 URL \u91cd\u5199\u8ddf\u8e2a\u7528\u6237\u72b6\u6001\u3002\u82e5\u4ec5\u901a\u8fc7 IPC \u901a\u4fe1&#xff0c;\u5f00\u53d1\u8005\u9700\u81ea\u884c\u5b9e\u73b0\u4f1a\u8bdd\u673a\u5236&#xff0c;\u589e\u52a0\u5f00\u53d1\u96be\u5ea6\u3002 \u200b\u200b\u6807\u51c6\u5316\u4e0e\u6269\u5c55\u6027\u200b\u200b Tomcat \u9075\u5faa Java Servlet \u89c4\u8303&#xff0c;\u4e0e Spring\u3001JSP \u7b49\u6280\u672f\u65e0\u7f1d\u96c6\u6210&#xff0c;\u652f\u6301 WebSocket\u3001JSP \u52a8\u6001\u9875\u9762\u6e32\u67d3\u7b49\u9ad8\u7ea7\u529f\u80fd\u3002\u8fd9\u79cd\u6807\u51c6\u5316\u8bbe\u8ba1\u4f7f\u5f97 Web \u5e94\u7528\u5177\u5907\u8de8\u670d\u52a1\u5668\u517c\u5bb9\u6027\u3002<\/p>\n<p>\u4e8c\u3001\u8fdb\u7a0b\u95f4\u901a\u4fe1&#xff08;IPC&#xff09;\u7684\u5c40\u9650\u6027 \u200b\u200b\u529f\u80fd\u5b9a\u4f4d\u4e0d\u540c\u200b\u200b IPC&#xff08;\u5982 Socket\u3001\u5171\u4eab\u5185\u5b58&#xff09;\u662f\u901a\u7528\u6570\u636e\u4f20\u8f93\u673a\u5236&#xff0c;\u9002\u7528\u4e8e\u200b\u200b\u4efb\u610f\u8fdb\u7a0b\u95f4\u7684\u7b80\u5355\u6570\u636e\u4ea4\u6362\u200b\u200b\u3002\u4f46 Web \u5e94\u7528\u9700\u8981\u5b8c\u6574\u7684 HTTP \u670d\u52a1\u80fd\u529b&#xff08;\u5982\u8def\u7531\u3001\u534f\u8bae\u89e3\u6790\u3001\u5b89\u5168\u63a7\u5236&#xff09;&#xff0c;\u4ec5\u9760 IPC \u65e0\u6cd5\u6ee1\u8db3\u3002 \u200b\u200b\u5f00\u53d1\u590d\u6742\u5ea6\u9ad8\u200b\u200b \u82e5\u81ea\u884c\u5b9e\u73b0 Web \u670d\u52a1\u5668&#xff0c;\u5f00\u53d1\u8005\u9700\u5904\u7406\u4ee5\u4e0b\u95ee\u9898&#xff1a; HTTP \u534f\u8bae\u7684\u5b8c\u6574\u89e3\u6790&#xff08;\u5982\u5206\u5757\u4f20\u8f93\u3001\u957f\u8fde\u63a5&#xff09;\u3002 \u591a\u7ebf\u7a0b\u5e76\u53d1\u4e0b\u7684\u8d44\u6e90\u7ade\u4e89\u4e0e\u6b7b\u9501\u3002 SSL\/TLS \u52a0\u5bc6\u4e0e\u8bc1\u4e66\u7ba1\u7406\u3002 \u9759\u6001\u8d44\u6e90\u670d\u52a1\u4e0e\u52a8\u6001\u5185\u5bb9\u751f\u6210\u7684\u5206\u79bb\u3002 \u200b\u200b\u6027\u80fd\u4e0e\u4f18\u5316\u6311\u6218\u200b\u200b Tomcat \u901a\u8fc7 \u200b\u200bNIO&#xff08;\u975e\u963b\u585e I\/O&#xff09;\u200b\u200b\u3001\u200b\u200b\u8fde\u63a5\u6c60\u4f18\u5316\u200b\u200b\u3001\u200b\u200b\u5185\u5b58\u7ba1\u7406\u200b\u200b\u7b49\u673a\u5236\u63d0\u5347\u6027\u80fd&#xff0c;\u800c\u81ea\u884c\u5b9e\u73b0\u7684 IPC \u670d\u52a1\u901a\u5e38\u96be\u4ee5\u8fbe\u5230\u540c\u7b49\u6548\u7387\u3002<\/p>\n<p>\u4e09\u3001Tomcat \u4e0e IPC \u7684\u5173\u7cfb&#xff1a;\u534f\u4f5c\u800c\u975e\u66ff\u4ee3 \u200b\u200bTomcat \u5185\u90e8\u4f7f\u7528 IPC \u6280\u672f\u200b\u200b Tomcat \u7684\u5e95\u5c42\u901a\u4fe1&#xff08;\u5982\u5904\u7406 HTTP \u8bf7\u6c42&#xff09;\u4f9d\u8d56\u4e8e Socket \u548c\u7ebf\u7a0b\u6c60&#xff0c;\u4f46\u5176\u6838\u5fc3\u4ef7\u503c\u5728\u4e8e\u200b\u200b\u5bf9\u901a\u4fe1\u7684\u5c01\u88c5\u4e0e\u62bd\u8c61\u200b\u200b\u3002\u4f8b\u5982&#xff0c;Tomcat \u7684 Connector \u7ec4\u4ef6\u901a\u8fc7 Socket \u63a5\u6536\u8bf7\u6c42&#xff0c;\u5e76\u901a\u8fc7\u534f\u8bae\u89e3\u6790\u5c06\u5176\u8f6c\u5316\u4e3a Servlet \u53ef\u5904\u7406\u7684\u6807\u51c6\u5316\u5bf9\u8c61\u3002 \u200b\u200b\u7279\u5b9a\u573a\u666f\u7684 IPC \u8865\u5145\u200b\u200b \u5728\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d&#xff0c;Tomcat \u53ef\u80fd\u4e0e\u5176\u4ed6\u670d\u52a1&#xff08;\u5982\u6570\u636e\u5e93\u3001\u7f13\u5b58&#xff09;\u901a\u8fc7 IPC \u6216 RPC \u901a\u4fe1&#xff0c;\u4f46 Tomcat \u672c\u8eab\u7684\u5b58\u5728\u662f\u4e3a\u4e86\u63d0\u4f9b Web \u5c42\u7684\u80fd\u529b&#xff0c;\u800c\u975e\u66ff\u4ee3\u5176\u4ed6\u8fdb\u7a0b\u95f4\u7684\u901a\u4fe1\u9700\u6c42\u3002 \u56db\u3001\u603b\u7ed3&#xff1a;\u4e3a\u4ec0\u4e48\u9700\u8981 Tomcat&#xff1f; \u200b\u200b\u5f00\u53d1\u6548\u7387\u200b\u200b&#xff1a;Tomcat \u5c4f\u853d\u4e86 HTTP \u534f\u8bae\u548c\u7ebf\u7a0b\u7ba1\u7406\u7684\u590d\u6742\u6027&#xff0c;\u5f00\u53d1\u8005\u53ef\u4e13\u6ce8\u4e8e\u4e1a\u52a1\u4ee3\u7801\u3002 \u200b\u200b\u6027\u80fd\u4fdd\u969c\u200b\u200b&#xff1a;\u5185\u7f6e\u4f18\u5316\u673a\u5236&#xff08;\u5982\u7ebf\u7a0b\u6c60\u3001NIO&#xff09;\u786e\u4fdd\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u7a33\u5b9a\u6027\u3002 \u200b\u200b\u6807\u51c6\u5316\u652f\u6301\u200b\u200b&#xff1a;\u517c\u5bb9 Servlet\/JSP \u89c4\u8303&#xff0c;\u65e0\u7f1d\u96c6\u6210 Spring \u7b49\u4e3b\u6d41\u6846\u67b6\u3002 \u200b\u200b\u529f\u80fd\u5b8c\u6574\u6027\u200b\u200b&#xff1a;\u63d0\u4f9b\u4f1a\u8bdd\u7ba1\u7406\u3001\u5b89\u5168\u63a7\u5236\u3001\u9759\u6001\u8d44\u6e90\u670d\u52a1\u7b49 Web \u5e94\u7528\u5fc5\u9700\u7684\u529f\u80fd\u3002 \u82e5\u4ec5\u4f9d\u8d56\u8fdb\u7a0b\u95f4\u901a\u4fe1\u5b9e\u73b0 Web \u670d\u52a1&#xff0c;\u76f8\u5f53\u4e8e\u91cd\u590d\u9020\u8f6e\u5b50&#xff0c;\u4e14\u96be\u4ee5\u8fbe\u5230 Tomcat \u7684\u6210\u719f\u5ea6\u548c\u6027\u80fd\u3002\u56e0\u6b64&#xff0c;Tomcat \u662f Java Web \u5f00\u53d1\u4e2d\u4e0d\u53ef\u66ff\u4ee3\u7684\u57fa\u7840\u8bbe\u65bd\u3002<\/p>\n<h3>\u4ee3\u7801\u5bf9\u6bd4<\/h3>\n<p>\u7eaf Java Socket \u5b9e\u73b0\u8fdc\u7a0b\u901a\u4fe1\u200b<\/p>\n<p><span class=\"token comment\">\/\/ \u670d\u52a1\u7aef&#xff08;\u624b\u52a8\u5904\u7406\u534f\u8bae\u548c\u7ebf\u7a0b&#xff09;<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">SocketServer<\/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\">IOException<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">ServerSocket<\/span> serverSocket <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">ServerSocket<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">8080<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">while<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token boolean\">true<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token class-name\">Socket<\/span> clientSocket <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 keyword\">new<\/span> <span class=\"token class-name\">Thread<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">-&gt;<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                <span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                    <span class=\"token comment\">\/\/ \u624b\u52a8\u89e3\u6790 HTTP \u8bf7\u6c42<\/span><br \/>\n                    <span class=\"token class-name\">BufferedReader<\/span> reader <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">BufferedReader<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">new<\/span> <span class=\"token class-name\">InputStreamReader<\/span><span class=\"token punctuation\">(<\/span>clientSocket<span class=\"token punctuation\">.<\/span><span class=\"token function\">getInputStream<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n                    <span class=\"token class-name\">String<\/span> requestLine <span class=\"token operator\">&#061;<\/span> reader<span class=\"token punctuation\">.<\/span><span class=\"token function\">readLine<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n                    <span class=\"token class-name\">String<\/span><span class=\"token punctuation\">[<\/span><span class=\"token punctuation\">]<\/span> parts <span class=\"token operator\">&#061;<\/span> requestLine<span class=\"token punctuation\">.<\/span><span class=\"token function\">split<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034; &#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u89e3\u6790\u8bf7\u6c42\u65b9\u6cd5\u3001\u8def\u5f84\u7b49<\/span><\/p>\n<p>                    <span class=\"token comment\">\/\/ \u624b\u52a8\u751f\u6210\u54cd\u5e94<\/span><br \/>\n                    <span class=\"token class-name\">String<\/span> response <span class=\"token operator\">&#061;<\/span> <span class=\"token string\">&#034;HTTP\/1.1 200 OK\\\\r\\\\nContent-Type: text\/plain\\\\r\\\\n\\\\r\\\\nHello from Socket&#034;<\/span><span class=\"token punctuation\">;<\/span><br \/>\n                    clientSocket<span class=\"token punctuation\">.<\/span><span class=\"token function\">getOutputStream<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">write<\/span><span class=\"token punctuation\">(<\/span>response<span class=\"token punctuation\">.<\/span><span class=\"token function\">getBytes<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n                    clientSocket<span class=\"token punctuation\">.<\/span><span class=\"token function\">close<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n                <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">catch<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">IOException<\/span> e<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                    e<span class=\"token punctuation\">.<\/span><span class=\"token function\">printStackTrace<\/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><span class=\"token punctuation\">)<\/span><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><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ \u5ba2\u6237\u7aef<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">SocketClient<\/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\">IOException<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">Socket<\/span> socket <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Socket<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;localhost&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">8080<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">OutputStream<\/span> out <span class=\"token operator\">&#061;<\/span> socket<span class=\"token punctuation\">.<\/span><span class=\"token function\">getOutputStream<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        out<span class=\"token punctuation\">.<\/span><span class=\"token function\">write<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;GET \/hello HTTP\/1.1\\\\r\\\\nHost: localhost\\\\r\\\\n\\\\r\\\\n&#034;<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">getBytes<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token class-name\">BufferedReader<\/span> reader <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">BufferedReader<\/span><span class=\"token punctuation\">(<\/span><span class=\"token keyword\">new<\/span> <span class=\"token class-name\">InputStreamReader<\/span><span class=\"token punctuation\">(<\/span>socket<span class=\"token punctuation\">.<\/span><span class=\"token function\">getInputStream<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token class-name\">String<\/span> line<span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">while<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">(<\/span>line <span class=\"token operator\">&#061;<\/span> reader<span class=\"token punctuation\">.<\/span><span class=\"token function\">readLine<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">!&#061;<\/span> <span class=\"token keyword\">null<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token class-name\">System<\/span><span class=\"token punctuation\">.<\/span>out<span class=\"token punctuation\">.<\/span><span class=\"token function\">println<\/span><span class=\"token punctuation\">(<\/span>line<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u624b\u52a8\u89e3\u6790\u54cd\u5e94<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<h3>\u200bTomcat \u5bb9\u5668\u4e0b\u7684 Servlet \u5b9e\u73b0\u200b<\/h3>\n<p><span class=\"token comment\">\/\/ Servlet \u7c7b&#xff08;Tomcat \u81ea\u52a8\u7ba1\u7406\u534f\u8bae\u548c\u7ebf\u7a0b&#xff09;<\/span><br \/>\n<span class=\"token annotation punctuation\">&#064;WebServlet<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\/hello&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">HelloServlet<\/span> <span class=\"token keyword\">extends<\/span> <span class=\"token class-name\">HttpServlet<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token annotation punctuation\">&#064;Override<\/span><br \/>\n    <span class=\"token keyword\">protected<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">doGet<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">HttpServletRequest<\/span> req<span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">HttpServletResponse<\/span> resp<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ Tomcat \u81ea\u52a8\u5c01\u88c5\u8bf7\u6c42\u53c2\u6570\u5230 req \u5bf9\u8c61<\/span><br \/>\n        <span class=\"token class-name\">String<\/span> name <span class=\"token operator\">&#061;<\/span> req<span class=\"token punctuation\">.<\/span><span class=\"token function\">getParameter<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;name&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token comment\">\/\/ \u76f4\u63a5\u64cd\u4f5c\u54cd\u5e94\u5bf9\u8c61&#xff08;\u65e0\u9700\u5904\u7406\u534f\u8bae\u7ec6\u8282&#xff09;<\/span><br \/>\n        resp<span class=\"token punctuation\">.<\/span><span class=\"token function\">setContentType<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;text\/plain&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        resp<span class=\"token punctuation\">.<\/span><span class=\"token function\">getWriter<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">write<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;Hello &#034;<\/span> <span class=\"token operator\">&#043;<\/span> name<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><span class=\"token comment\">\/\/ \u5ba2\u6237\u7aef\u901a\u8fc7\u6d4f\u89c8\u5668\u76f4\u63a5\u8bbf\u95ee&#xff1a;http:\/\/localhost:8080\/hello?name&#061;World<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250515142737-6825f9d956673.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb676\u6b21\uff0c\u70b9\u8d5e17\u6b21\uff0c\u6536\u85cf11\u6b21\u3002Tomcat \u7684\u6838\u5fc3\u804c\u8d23\u662f\u5904\u7406 \u200b\u200bHTTP \u534f\u8bae\u200b\u200b\u7684\u89e3\u6790\u4e0e\u54cd\u5e94\uff0c\u5305\u62ec\u8bf7\u6c42\u5934\u89e3\u6790\u3001\u54cd\u5e94\u751f\u6210\u3001\u72b6\u6001\u7801\u7ba1\u7406\u3001SSL\/TLS \u52a0\u5bc6\u7b49\u3002\u9700\u8981 Tomcat \u7684\u4e3b\u8981\u539f\u56e0\u662f\u5176\u4f5c\u4e3a \u200b\u200bWeb \u5e94\u7528\u670d\u52a1\u5668\u200b\u200b\u548c \u200b\u200bServlet \u5bb9\u5668\u200b\u200b\u7684\u6838\u5fc3\u80fd\u529b\uff0c\u800c\u4e0d\u4ec5\u4ec5\u662f\u8fdb\u7a0b\u95f4\u901a\u4fe1\uff08IPC\uff09\u5de5\u5177\u3002Tomcat \u901a\u8fc7 \u200b\u200bNIO\uff08\u975e\u963b\u585e I\/O\uff09\u200b\u200b\u3001\u200b\u200b\u8fde\u63a5\u6c60\u4f18\u5316\u200b\u200b\u3001\u200b\u200b\u5185\u5b58\u7ba1\u7406\u200b\u200b\u7b49\u673a\u5236\u63d0\u5347\u6027\u80fd\uff0c\u800c\u81ea\u884c\u5b9e\u73b0\u7684 IPC \u670d\u52a1\u901a\u5e38\u96be\u4ee5\u8fbe\u5230\u540c\u7b49\u6548\u7387\u3002\u200b\u200b\u6027\u80fd\u4fdd\u969c\u200b\u200b\uff1a\u5185\u7f6e\u4f18\u5316\u673a\u5236\uff08\u5982\u7ebf\u7a0b\u6c60\u3001NIO\uff09\u786e\u4fdd\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u7a33\u5b9a\u6027\u3002<\/p>\n","protected":false},"author":2,"featured_media":37363,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99,223,190],"topic":[],"class_list":["post-37364","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-java","tag-tomcat","tag-190"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Tomcat\u4e0e\u7eaf Java Socket \u5b9e\u73b0\u8fdc\u7a0b\u901a\u4fe1\u7684\u533a\u522b - \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\/37364.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Tomcat\u4e0e\u7eaf Java Socket \u5b9e\u73b0\u8fdc\u7a0b\u901a\u4fe1\u7684\u533a\u522b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb676\u6b21\uff0c\u70b9\u8d5e17\u6b21\uff0c\u6536\u85cf11\u6b21\u3002Tomcat \u7684\u6838\u5fc3\u804c\u8d23\u662f\u5904\u7406 \u200b\u200bHTTP \u534f\u8bae\u200b\u200b\u7684\u89e3\u6790\u4e0e\u54cd\u5e94\uff0c\u5305\u62ec\u8bf7\u6c42\u5934\u89e3\u6790\u3001\u54cd\u5e94\u751f\u6210\u3001\u72b6\u6001\u7801\u7ba1\u7406\u3001SSL\/TLS \u52a0\u5bc6\u7b49\u3002\u9700\u8981 Tomcat \u7684\u4e3b\u8981\u539f\u56e0\u662f\u5176\u4f5c\u4e3a \u200b\u200bWeb \u5e94\u7528\u670d\u52a1\u5668\u200b\u200b\u548c \u200b\u200bServlet \u5bb9\u5668\u200b\u200b\u7684\u6838\u5fc3\u80fd\u529b\uff0c\u800c\u4e0d\u4ec5\u4ec5\u662f\u8fdb\u7a0b\u95f4\u901a\u4fe1\uff08IPC\uff09\u5de5\u5177\u3002Tomcat \u901a\u8fc7 \u200b\u200bNIO\uff08\u975e\u963b\u585e I\/O\uff09\u200b\u200b\u3001\u200b\u200b\u8fde\u63a5\u6c60\u4f18\u5316\u200b\u200b\u3001\u200b\u200b\u5185\u5b58\u7ba1\u7406\u200b\u200b\u7b49\u673a\u5236\u63d0\u5347\u6027\u80fd\uff0c\u800c\u81ea\u884c\u5b9e\u73b0\u7684 IPC \u670d\u52a1\u901a\u5e38\u96be\u4ee5\u8fbe\u5230\u540c\u7b49\u6548\u7387\u3002\u200b\u200b\u6027\u80fd\u4fdd\u969c\u200b\u200b\uff1a\u5185\u7f6e\u4f18\u5316\u673a\u5236\uff08\u5982\u7ebf\u7a0b\u6c60\u3001NIO\uff09\u786e\u4fdd\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u7a33\u5b9a\u6027\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/37364.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-05-15T14:27:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250515142737-6825f9d956673.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=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/37364.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/37364.html\",\"name\":\"Tomcat\u4e0e\u7eaf Java Socket \u5b9e\u73b0\u8fdc\u7a0b\u901a\u4fe1\u7684\u533a\u522b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-05-15T14:27:38+00:00\",\"dateModified\":\"2025-05-15T14:27:38+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/37364.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/37364.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/37364.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Tomcat\u4e0e\u7eaf Java Socket \u5b9e\u73b0\u8fdc\u7a0b\u901a\u4fe1\u7684\u533a\u522b\"}]},{\"@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":"Tomcat\u4e0e\u7eaf Java Socket \u5b9e\u73b0\u8fdc\u7a0b\u901a\u4fe1\u7684\u533a\u522b - \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\/37364.html","og_locale":"zh_CN","og_type":"article","og_title":"Tomcat\u4e0e\u7eaf Java Socket \u5b9e\u73b0\u8fdc\u7a0b\u901a\u4fe1\u7684\u533a\u522b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb676\u6b21\uff0c\u70b9\u8d5e17\u6b21\uff0c\u6536\u85cf11\u6b21\u3002Tomcat \u7684\u6838\u5fc3\u804c\u8d23\u662f\u5904\u7406 \u200b\u200bHTTP \u534f\u8bae\u200b\u200b\u7684\u89e3\u6790\u4e0e\u54cd\u5e94\uff0c\u5305\u62ec\u8bf7\u6c42\u5934\u89e3\u6790\u3001\u54cd\u5e94\u751f\u6210\u3001\u72b6\u6001\u7801\u7ba1\u7406\u3001SSL\/TLS \u52a0\u5bc6\u7b49\u3002\u9700\u8981 Tomcat \u7684\u4e3b\u8981\u539f\u56e0\u662f\u5176\u4f5c\u4e3a \u200b\u200bWeb \u5e94\u7528\u670d\u52a1\u5668\u200b\u200b\u548c \u200b\u200bServlet \u5bb9\u5668\u200b\u200b\u7684\u6838\u5fc3\u80fd\u529b\uff0c\u800c\u4e0d\u4ec5\u4ec5\u662f\u8fdb\u7a0b\u95f4\u901a\u4fe1\uff08IPC\uff09\u5de5\u5177\u3002Tomcat \u901a\u8fc7 \u200b\u200bNIO\uff08\u975e\u963b\u585e I\/O\uff09\u200b\u200b\u3001\u200b\u200b\u8fde\u63a5\u6c60\u4f18\u5316\u200b\u200b\u3001\u200b\u200b\u5185\u5b58\u7ba1\u7406\u200b\u200b\u7b49\u673a\u5236\u63d0\u5347\u6027\u80fd\uff0c\u800c\u81ea\u884c\u5b9e\u73b0\u7684 IPC \u670d\u52a1\u901a\u5e38\u96be\u4ee5\u8fbe\u5230\u540c\u7b49\u6548\u7387\u3002\u200b\u200b\u6027\u80fd\u4fdd\u969c\u200b\u200b\uff1a\u5185\u7f6e\u4f18\u5316\u673a\u5236\uff08\u5982\u7ebf\u7a0b\u6c60\u3001NIO\uff09\u786e\u4fdd\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u7684\u7a33\u5b9a\u6027\u3002","og_url":"https:\/\/www.wsisp.com\/helps\/37364.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-05-15T14:27:38+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/05\/20250515142737-6825f9d956673.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/37364.html","url":"https:\/\/www.wsisp.com\/helps\/37364.html","name":"Tomcat\u4e0e\u7eaf Java Socket \u5b9e\u73b0\u8fdc\u7a0b\u901a\u4fe1\u7684\u533a\u522b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-05-15T14:27:38+00:00","dateModified":"2025-05-15T14:27:38+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/37364.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/37364.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/37364.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Tomcat\u4e0e\u7eaf Java Socket \u5b9e\u73b0\u8fdc\u7a0b\u901a\u4fe1\u7684\u533a\u522b"}]},{"@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\/37364","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=37364"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/37364\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/37363"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=37364"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=37364"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=37364"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=37364"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}