{"id":4283,"date":"2016-10-25T12:31:00","date_gmt":"2016-10-25T04:31:00","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=4283"},"modified":"2016-10-25T12:35:45","modified_gmt":"2016-10-25T04:35:45","slug":"delphi-yxdiocp-%e4%b9%8b-mvc-%e7%ae%80%e4%bb%8b","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=4283","title":{"rendered":"[Delphi] YxdIOCP \u4e4b MVC \u7b80\u4ecb"},"content":{"rendered":"<p>\u539f\u6587\u5730\u5740\uff1a <a href=\"http:\/\/www.cnblogs.com\/yangyxd\/articles\/5993764.html\">http:\/\/www.cnblogs.com\/yangyxd\/articles\/5993764.html<\/a><\/p>\n<p>YxdIocp:\u00a0 <a href=\"https:\/\/github.com\/yangyxd\/YxdIOCP\">https:\/\/github.com\/yangyxd\/YxdIOCP<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>\u6700\u8fd1\u4e3a YxdIocp \u5f00\u6e90\u5e93\u589e\u52a0\u4e86\u8fd9\u4e2a\u8f7b\u91cf\u7ea7\u7684 MVC \u652f\u6301\u3002\u5176\u5b9e\u8bf4\u662f MVC \uff0c\u4f46\u7531\u4e8e\u73b0\u5728\u8fd8\u6ca1\u6709\u914d\u5957\u7684\u89c6\u56fe\u6a21\u7248\u5f15\u64ce\uff0c\u6240\u4ee5\u5728V\u4e0a\u9762\u5f88\u865a\u5f31\u3002\u4e0d\u8fc7\u672c\u7740\u505a\u6570\u636e\u670d\u52a1\u4e3a\u4e3b\u7684\u601d\u60f3\uff0c\u73b0\u5728\u5df2\u7ecf\u57fa\u672c\u591f\u7528\u4e86\u3002\u4e0b\u9762\u6765\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b\u5b83\u5427\u3002<\/p>\n<p>\u8981\u4f7f\u7528 MVC \u529f\u80fd\u975e\u5e38\u7b80\u5355\uff0c \u5f15\u7528 iocp.Http.MVC \u5355\u5143\uff0c\u6216\u8005\u5728\u7a97\u4f53\u4e0a\u653e\u5165\u4e00\u4e2a TIocpHttpMvcServer \u7ec4\u4ef6\u5373\u53ef\u3002\u7136\u540e\u5c31\u662f\u7f16\u5199\u4e1a\u52a1\u4ee3\u7801 (\u53ef\u53c2\u8003\u5f00\u6e90\u5e93\u4e2d demo\\IcopHttpSvrMVC \u4e2d\u7684\u4ee3\u7801)\u3002iocp.Http.MVC \u5f15\u5165\u4e86\u591a\u4e2a\u5c5e\u6027\u6807\u6ce8\uff0c\u5b83\u662f MVC \u7684\u7075\u9b42\uff0c\u8981\u7528\u597d MVC\uff0c \u5fc5\u987b\u4e86\u89e3\u8fd9\u4e9b\u5c5e\u6027\u6807\u6ce8\u7684\u529f\u80fd\u548c\u610f\u4e49\u3002MVC\u5f15\u64ce\u4f1a\u4f7f\u7528\u626b\u63cf\u5668\u6839\u636e\u8fd9\u4e9b\u6807\u6ce8\u81ea\u52a8\u626b\u63cf\u6ce8\u5165\uff0c\u54cd\u5e94\u5ba2\u6237\u8bf7\u6c42\u3002<\/p>\n<p>\u5728\u6b64\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u6ce8\u610f\u4e00\u70b9\uff0c\u5728 Delphi \u4e2d\uff0c \u5c5e\u6027\u6807\u6ce8\u5b9a\u4e49\u7684\u540d\u79f0\u5c3e\u90e8\u5982\u679c\u662f &#8220;Attribute&#8221;,\u00a0 \u5728\u4f7f\u7528\u65f6\u53ef\u4ee5\u76f4\u63a5\u7701\u7565\u540e\u9762\u7684 &#8220;Attribute&#8221; \uff0c\u6bd4\u5982\u5b9a\u4e49\u4e86\u201cServiceAttribute\u201d\u6807\u6ce8\uff0c\u4f7f\u7528\u65f6\u53ef\u4ee5\u53ea\u8f93\u5165 &#8220;[Service]&#8221; \u5373\u53ef\u3002\u4e0b\u9762\u8bb2\u5230\u7684\u5c5e\u6027\u6807\u6ce8\uff0c\u90fd\u662f\u7701\u7565\u6389\u4e86 &#8220;Attribute&#8221; \u3002<\/p>\n<p>&nbsp;<\/p>\n<h1>\u4e00\u3001\u5c5e\u6027\u6807\u6ce8\u8bf4\u660e<\/h1>\n<h2>[Service]<\/h2>\n<p>\u4e1a\u52a1\u5c42\u6807\u8bc6\u6027\u6807\u6ce8\uff0c\u4e3a\u6307\u5b9a\u7c7b\u6dfb\u52a0\u6b64\u6807\u6ce8\u540e\uff0c\u6b64\u7c7b\u624d\u4f1a\u88abMVC\u5f15\u64ce\u8bc6\u522b\uff0c\u4ece\u800c\u5177\u5907\u4e1a\u52a1\u8bf7\u6c42\u5904\u7406\u80fd\u529b\u3002<\/p>\n<pre class=\"lang:delphi decode:true \">uses\r\n  iocp.Http.MVC, iocp.Http, SysUtils, Classes;\r\n\r\ntype\r\n  [Service]\r\n  THelloMvc = class(TObject)\r\n  public\r\n  end;<\/pre>\n<p>&nbsp;<\/p>\n<p>\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4ee3\u7801\u4e2d\uff0c\u7531\u4e8e\u52a0\u5165\u4e86 [Service] \u6807\u8bc6\uff0c\u4f1a\u88ab MVC \u626b\u63cf\u5668\u53d1\u73b0\u8be5\u7c7b\uff0c\u5e76\u81ea\u52a8\u521b\u5efa\u4e00\u4e2a\u5355\u4f8b\u7528\u4e8e\u54cd\u5e94\u4e1a\u52a1\u8bf7\u6c42\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>[Controller]<\/h2>\n<p>\u63a7\u5236\u5c42\u6807\u6ce8\u3002\u589e\u52a0\u6b64\u6807\u6ce8\u540e\uff0c\u6307\u5b9a\u7c7b\u624d\u5177\u5907\u5904\u7406\u4e1a\u52a1\u8bf7\u6c42\u7684\u80fd\u529b\u3002\u6b64\u6807\u6ce8\u548c [Service] \u529f\u80fd\u4e00\u6837\uff0c\u53ea\u662f\u65b9\u4fbf\u5728\u4e00\u4e9b\u60c5\u51b5\u4e0b\u533a\u5206\u4e1a\u52a1\u7c7b\u522b\u3002<\/p>\n<pre class=\"lang:delphi decode:true \">uses\r\n  iocp.Http.MVC, iocp.Http, SysUtils, Classes;\r\n\r\ntype\r\n  [Controller]\r\n  THelloMvc = class(TObject)\r\n  public\r\n  end;<\/pre>\n<p>&nbsp;<\/p>\n<h2>[Autowired]<\/h2>\n<p>\u81ea\u52a8\u88c5\u914d\u6807\u6ce8\u3002\u4e3a\u4e00\u4e2a\u7c7b\u4e2d\u7684\u53d8\u91cf\u589e\u52a0\u6b64\u6807\u6ce8\u540e\uff0cMVC \u5f15\u64ce\u4f1a\u5728\u5b9e\u4f8b\u5316\u6b64\u7c7b\u65f6\uff0c\u4e3a\u8fd9\u4e2a\u6210\u5458\u53d8\u91cf\u81ea\u52a8\u6ce8\u5165\u9002\u5f53\u7684\u503c\u3002<span style=\"color: #888888\">\uff08\u76ee\u524d\u7531\u4e8e\u6682\u65e0IOC\u5b9e\u73b0\uff0c\u53ea\u80fd\u81ea\u52a8\u6ce8\u5165TIocpWebSocketServer\u3001Ser ver\uff09<\/span><\/p>\n<pre class=\"lang:delphi decode:true \">type\r\n  [Controller]\r\n  THelloMvc = class(TObject)\r\n  protected\r\n    [Autowired]\r\n    FServer: TIocpHttpServer;\r\n  public\r\n  end;<\/pre>\n<p>&nbsp;<\/p>\n<p>\u7a0b\u5e8f\u8fd0\u884c\u540e\uff0c\u4f1a\u81ea\u52a8\u5c06 FServer \u521d\u59cb\u5316\u4e3a HttpMVC.Server \u3002<\/p>\n<h2>[RequestMapping]<\/h2>\n<p>\u8bf7\u6c42\u5730\u5740\u6620\u5c04\u6807\u6ce8\u3002\u6b64\u6807\u6ce8\u53ef\u7528\u4e8e\u7c7b\u7ea7\u522b\uff0c\u4e5f\u53ef\u7528\u4e8e\u7c7b\u4e2d\u7684\u51fd\u6570\u6216\u65b9\u6cd5\u4e0a\u3002<\/p>\n<p>\u6b64\u6807\u6ce8\u6709\u5982\u4e0b\u51e0\u4e2a\u5c5e\u6027\uff1a<\/p>\n<ul>\n<li><strong>Value<\/strong>:\u00a0 \u6307\u5b9a\u8bf7\u6c42\u7684\u5b9e\u9645\u5730\u5740\u3002<\/li>\n<li><strong>Method<\/strong>: \u6307\u5b9a\u8bf7\u6c42\u7684method\u7c7b\u578b\uff0c \u5b83\u662f TIocpHttpMethod \u7c7b\u578b\u7684\u679a\u4e3e\u503c\uff0c\u53ef\u4ee5\u662f GET\u3001POST\u3001PUT\u3001DELETE \u7b49\u3002<\/li>\n<li><strong>Consumes<\/strong>: \u6307\u5b9a\u5904\u7406\u8bf7\u6c42\u7684\u63d0\u4ea4\u5185\u5bb9\u7c7b\u578b\uff08Content-Type\uff09\uff0c\u4f8b\u5982application\/json, text\/html\u3002<\/li>\n<li><strong>Produces<\/strong>: \u6307\u5b9a\u8fd4\u56de\u7684\u5185\u5bb9\u7c7b\u578b\uff0c\u4ec5\u5f53request\u8bf7\u6c42\u5934\u4e2d\u7684(Accept)\u7c7b\u578b\u4e2d\u5305\u542b\u8be5\u6307\u5b9a\u7c7b\u578b\u624d\u8fd4\u56de\u3002<\/li>\n<li><strong>Params<\/strong>: \u6307\u5b9arequest\u4e2d\u5fc5\u987b\u5305\u542b\u67d0\u4e9b\u53c2\u6570\u503c\u65f6\uff0c\u624d\u8ba9\u8be5\u65b9\u6cd5\u5904\u7406\u3002<\/li>\n<li><strong>Headers<\/strong>: \u6307\u5b9arequest\u4e2d\u5fc5\u987b\u5305\u542b\u67d0\u4e9b\u6307\u5b9a\u7684header\u503c\uff0c\u624d\u80fd\u8ba9\u8be5\u65b9\u6cd5\u5904\u7406\u8bf7\u6c42\u3002<\/li>\n<\/ul>\n<p><strong>\u6ce8\u610f<\/strong>\uff1a \u5728\u7c7b\u7ea7\u522b\u4f7f\u7528\u6b64\u6807\u6ce8\u65f6\uff0c Params \u5c5e\u6027\u65e0\u6548\u3002\u7c7b\u7ea7\u522b\u4e3b\u8981\u7528\u4e8e\u8bbe\u7f6eURL\u7684\u57fa\u5740\uff0c\u4ee5\u53ca\u4e00\u4e9b\u9ed8\u8ba4\u503c\u3002\u6bd4\u5982\u5728\u7c7b\u7ea7\u522b\u6307\u5b9a Method \u4e3a Post\uff0c\u90a3\u4e48\u7c7b\u4e2d\u7684\u51fd\u6570\u6216\u65b9\u6cd5\u6620\u5c04\u65f6\uff0c\u5982\u679c\u672a\u6307\u5b9a Method, \u90a3\u4e48\u9ed8\u8ba4\u5c31\u662f Post\u3002\u53e6\u5916\uff0c\u5728\u51fd\u6570\u6216\u65b9\u6cd5\u88ab\u89e6\u53d1\u65f6\uff0c\u4ee5\u4e0b\u7c7b\u578b\u7684\u53c2\u6570\u4f1a\u88ab\u81ea\u52a8\u6ce8\u5165\uff1a<\/p>\n<ul>\n<li><strong>TIocpHttpRequest<\/strong>\uff1a \u81ea\u52a8\u6ce8\u5165\u4e3a\u5f53\u524dRequest\u5bf9\u8c61\u3002<\/li>\n<li><strong>TIocpHttpResponse<\/strong>\uff1a \u81ea\u52a8\u6ce8\u5165\u4f1a\u5f53\u524dResponse\u5bf9\u8c61\u3002<\/li>\n<li><strong>TIocpHttpServer<\/strong>\uff1a \u81ea\u52a8\u6ce8\u5165\u4f1a\u5f53\u524dServer\u5bf9\u8c61\u3002<\/li>\n<li><strong>TIocpWebSocketServer<\/strong>\uff1a \u542f\u7528 WebSocket \u65f6\uff0c\u81ea\u52a8\u6ce8\u5165\u5f53\u524d Server \u5bf9\u8c61\u3002<\/li>\n<li><strong>TIocpHttpWriter<\/strong>\uff1a \u81ea\u52a8\u6ce8\u5165 Response.GetOutWriter \u5bf9\u8c61\uff0c\u7528\u4e8e\u76f4\u63a5\u8f93\u51fa\u8fd4\u56de\u6570\u636e\u3002<\/li>\n<li><strong>TIocpHttpConnection<\/strong>\u3001<strong>TIocpClientContext<\/strong>\uff1a\u81ea\u52a8\u6ce8\u5165\u5f53\u524d\u8fde\u63a5\u5bf9\u8c61\uff08Request.Connection\uff09\u3002<\/li>\n<li><strong>TMemoryStream \u6216\u57fa\u4e8e TStream<\/strong>\uff1a \u81ea\u52a8\u6ce8\u5165\u5f53\u524d\u8bf7\u6c42\u7684\u6570\u636e\u6d41\u5bf9\u8c61\uff08Request.Data\uff09\u3002<\/li>\n<\/ul>\n<p>\u53e6\u5916\uff0c\u5982\u679c\u53c2\u6570\u540d\u662f \u201c<strong>RequestData<\/strong>\u201d\uff0c \u4e14\u4e3a\u5b57\u7b26\u4e32\u7c7b\u578b\u65f6\uff0c\u81ea\u52a8\u6ce8\u5165 Request.DataString \u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u793a\u4f8b<\/strong>\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">unit Unit2;\r\n\r\ninterface\r\n\r\nuses\r\n  iocp.Http.MVC, iocp.Http, SysUtils, Classes;\r\n\r\ntype\r\n  [Controller]\r\n  [RequestMapping('\/hello')]\r\n  THelloMvc = class(TObject)\r\n  public\r\n    \/\/ \u6620\u5c04\u5730\u5740\uff1a\/hello\/view1\r\n    \/\/ \u54cd\u5e94\u6240\u6709\u7c7b\u578b\u7684\u8bf7\u6c42(Get, Post, Put \u7b49\u7b49)\r\n    [RequestMapping('\/view1')]\r\n    function View1(Request: TIocpHttpRequest): string;\r\n\r\n    \/\/ \u6620\u5c04\u5730\u5740\uff1a\/hello\/view2\r\n    \/\/ \u54cd\u5e94 Get \u8bf7\u6c42\r\n    [RequestMapping('\/view2', http_GET)]\r\n    function View2(Request: TIocpHttpRequest): string;\r\n\r\n    \/\/ \u6620\u5c04\u5730\u5740\uff1a\/hello\/view3\/aaa?uid=123\r\n    \/\/ \u54cd\u5e94 Get \u8bf7\u6c42, \u5e76\u4e14\u5fc5\u987b\u662f\u5305\u542b\u53c2\u6570uid\uff0c\u503c\u4e3a123\u65f6\u624d\u54cd\u5e94\r\n    \/\/ \u5982\u679c\u53c2\u6570\u4e2d\u4e0d\u5305\u62ecuid\uff0c\u6216\u8005uid\u7684\u503c\u4e0d\u4e3a123\uff0c\u4f1a\u8fd4\u56de405\u9519\u8bef\r\n    [RequestMapping('\/view3\/aaa', http_GET, 'uid=123')]\r\n    function View3(Request: TIocpHttpRequest): string;\r\n\r\n    \/\/ \u6620\u5c04\u5730\u5740\uff1a\/hello\/view4?uid=123\r\n    \/\/ \u5fc5\u987b\u662f Get \u8bf7\u6c42, Content-Type\u5fc5\u987b\u5305\u542bapplication\/json\uff0c\r\n    \/\/ Accept\u5fc5\u987b\u662f\"*.*\"\u6216\u8005\u5305\u542b\u201capplication\/json\u201d \uff0c\r\n    \/\/ \u5fc5\u987b\u5305\u542b\u53c2\u6570uid=123\r\n    \/\/ \u5982\u679c\u4e0d\u7b26\u5408\u6761\u4ef6\u4f1a\u8fd4\u56de405\u9519\u8bef\r\n    [RequestMapping('\/view4', http_GET, 'application\/json', 'application\/json', 'uid=123')]\r\n    function View4(Request: TIocpHttpRequest): string;\r\n  end;\r\n\r\nimplementation\r\n\r\n{ THelloMvc }\r\n\r\nfunction THelloMvc.View1(Request: TIocpHttpRequest): string;\r\nbegin\r\n  Result := 'httpPostTest.html';\r\nend;\r\n\r\nfunction THelloMvc.View2(Request: TIocpHttpRequest): string;\r\nbegin\r\n  Result := 'httpPostTest.html';\r\nend;\r\n\r\nfunction THelloMvc.View3(Request: TIocpHttpRequest): string;\r\nbegin\r\n  Result := 'httpPostTest.html';\r\nend;\r\n\r\nfunction THelloMvc.View4(Request: TIocpHttpRequest): string;\r\nbegin\r\n  Result := 'httpPostTest.html';\r\nend;\r\n\r\ninitialization\r\n  THelloMvc.RegToMVC;\r\n\r\nend.<\/pre>\n<p>&nbsp;<\/p>\n<p>\u5982\u679c\u670d\u52a1\u5668Host\u662f: http:\/\/127.0.0.1:8080\uff0c<\/p>\n<p>\u90a3\u4e48\uff0c<\/p>\n<p>&nbsp;<\/p>\n<p>URL\uff1a http:\/\/127.0.0.1:8080\/view1<\/p>\n<p>HTTP: \u4e0d\u9650\uff08GET, POST, PUT&#8230;\uff09<\/p>\n<p>\u89e6\u53d1\uff1a THelloMvc.View1<\/p>\n<p>&nbsp;<\/p>\n<p>URL\uff1a http:\/\/127.0.0.1:8080\/<span style=\"color: #800000\">view2<\/span><\/p>\n<p><span style=\"color: #800000\">HTTP: GET<\/span><\/p>\n<p>\u89e6\u53d1\uff1a THelloMvc.View2<\/p>\n<p>&nbsp;<\/p>\n<p>URL\uff1a http:\/\/127.0.0.1:8080\/<span style=\"color: #800000\">view3\/aaa?uid=123<\/span><\/p>\n<p><span style=\"color: #800000\">HTTP: GET<\/span><\/p>\n<p>\u89e6\u53d1\uff1a THelloMvc.View3<\/p>\n<p>&nbsp;<\/p>\n<p>URL\uff1a http:\/\/127.0.0.1:8080\/<span style=\"color: #800000\">view3\/aaa?uid=789<\/span><\/p>\n<p><span style=\"color: #800000\">HTTP: GET<\/span><\/p>\n<p>\u89e6\u53d1\uff1a \u65e0\uff0c\u8fd4\u56de405\u9519\u8bef<\/p>\n<p>&nbsp;<\/p>\n<p>URL\uff1a http:\/\/127.0.0.1:8080\/<span style=\"color: #800000\">view3<\/span><\/p>\n<p><span style=\"color: #800000\">HTTP: GET<\/span><\/p>\n<p>\u89e6\u53d1\uff1a \u65e0\uff0c\u8fd4\u56de404\u9519\u8bef<\/p>\n<p>&nbsp;<\/p>\n<p>URL\uff1a http:\/\/127.0.0.1:8080\/<span style=\"color: #800000\">view4?uid=123<\/span><\/p>\n<p><span style=\"color: #800000\">HTTP: GET<\/span><\/p>\n<p>\u89e6\u53d1\uff1a \u65e0\uff0c\u8fd4\u56de405\u9519\u8bef<\/p>\n<p>\u539f\u56e0\uff1a \u6ca1\u6709\u5728Http Header \u7684&#8221;Content-Type&#8221;\u5c5e\u6027\u4e2d\u6dfb\u52a0 &#8220;application\/JSON&#8221;\uff0c\u9700\u8981\u4f7f\u7528\u7c7b\u4f3c\u4e0b\u9762\u7684\u8bf7\u6c42\u5934\u624d\u53ef\u4ee5\u6b63\u5e38\u8bbf\u95ee\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">GET \/hello\/view4?uid=123 HTTP\/1.1\r\nAccept: *\/*\r\nUser-Agent: Mozilla\/5.0 (Windows NT 5.1; rv:12.0) Gecko\/20100101 Firefox\/12.0\r\nContent-Type: application\/JSON; charset=GB2312\r\nAccept-Encoding: gzip, deflate\r\nContent-Length: 0\r\nAccept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3\r\nConnection: Keep-Alive<\/pre>\n<p>\u4f7f\u7528\u4e0a\u9762\u7684\u8bf7\u6c42\u5934\uff0c\u4f1a\u89e6\u53d1 THelloMvc.View4 \u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>[Download]<\/h2>\n<p>\u6807\u8bc6\u8bf7\u6c42\u8fd4\u56de\u9875\u9762\u91c7\u7528\u4e0b\u8f7d\u65b9\u5f0f\u3002\u52a0\u5165\u6b64\u6807\u6ce8\u540e\uff0c\u4f1a\u5728Http\u54cd\u5e94\u5934\u4e2d\u52a0\u5165\u6587\u4ef6\u4e0b\u8f7d\u6807\u8bc6\uff0c\u6d4f\u89c8\u4f1a\u4ee5\u6587\u4ef6\u4e0b\u8f7d\u7684\u65b9\u5f0f\u8bfb\u53d6\u6570\u636e\uff0c\u4e00\u822c\u4f1a\u63d0\u793a\u7528\u6237\u4fdd\u5b58\u6587\u4ef6\u3002<\/p>\n<pre class=\"lang:delphi decode:true \">type\r\n  [Controller]\r\n  THelloMvc = class(TObject)\r\n  public\r\n    [Download]\r\n    function FileDownload(Request: TIocpHttpRequest): string;\r\n  end;<\/pre>\n<h2><\/h2>\n<h2>[WebSocket]<\/h2>\n<p>WebSocket \u8bf7\u6c42\u5904\u7406\u6807\u6ce8\u3002\u5f53\u7c7b\u4e2d\u7684\u4e00\u4e2a\u51fd\u6570\u6216\u65b9\u6cd5\u8981\u7528\u6765\u5904\u7406 WebSocket \u8bf7\u6c42\u65f6\uff0c\u9700\u8981\u6dfb\u52a0\u6b64\u6807\u6ce8\u3002\u6b64\u6807\u6ce8\u4e0d\u80fd\u4e0e [RequestMapping] \u6df7\u7528\u3002<\/p>\n<p>\u6b64\u6807\u6ce8\u6709\u5982\u4e0b\u51e0\u4e2a\u5c5e\u6027\uff1a<\/p>\n<ul>\n<li><strong>Data<\/strong>\uff1a \u6307\u5b9a\u4ec5\u5f53Data\u4e3a\u6307\u5b9a\u5185\u5bb9\u7684\u6587\u672c\u6d88\u606f\u65f6\u624d\u54cd\u5e94\u3002<\/li>\n<\/ul>\n<pre class=\"lang:delphi decode:true \">    \/\/ WebSocket \u8bf7\u6c42\u5904\u7406\uff0c\u76f4\u63a5\u8fd4\u56de\u5b57\u7b26\u4e32\u5185\u5bb9\r\n    [WebSocket]\r\n    function HelloWebSocket(): string;\r\n\r\n    \/\/ WebSocket \u8bf7\u6c42\u5904\u7406, \u53ea\u6709\u63a5\u6536\u5230\u6587\u672c\u4fe1\u606f\u4e14\u5185\u5bb9\u662f 'hello' \u65f6\u624d\u54cd\u5e94\r\n    [WebSocket('hello')]\r\n    procedure HelloWebSocket2(Response: TIocpWebSocketResponse);<\/pre>\n<h2>[PathVariable]<\/h2>\n<p>\u8fd9\u662f\u4e00\u4e2a\u53c2\u6570\u7ea7\u7684\u5c5e\u6027\u6807\u6ce8\uff0c\u7528\u6765\u83b7\u5f97\u8bf7\u6c42url\u4e2d\u7684\u52a8\u6001\u53c2\u6570\uff0c\u5e76\u7ed1\u5b9a\u5230\u5904\u7406\u51fd\u6570\u4e2d\u6307\u5b9a\u53c2\u6570\u4e0a\u3002\u5982\u679c\u53c2\u6570\u7c7b\u578b\u4e0e\u5b9e\u9645\u4f20\u5165\u7684\u5185\u5bb9\u4e0d\u7b26\uff0c\u4f1a\u4ea7\u751f 500 \u9519\u8bef\u3002<\/p>\n<p>\u6b64\u6807\u6ce8\u6709\u5982\u4e0b\u51e0\u4e2a\u5c5e\u6027\uff1a<\/p>\n<ul>\n<li><strong>Name<\/strong>: \u5f53\u65b9\u6cd5\u53c2\u6570\u540d\u79f0\u548c\u9700\u8981\u7ed1\u5b9a\u7684uri template\u4e2d\u53d8\u91cf\u540d\u79f0\u4e0d\u4e00\u81f4\u65f6, \u7528\u4e8e\u6307\u5b9auri template\u7684\u540d\u79f0\u3002\u5982\u679c\u4e00\u81f4\uff0c\u53ef\u4ee5\u7701\u7565\u3002<\/li>\n<\/ul>\n<p>URL\u4e2d\u7684\u52a8\u6001\u53c2\u6570\uff0c\u9700\u8981\u4ee5 &#8220;{}&#8221; \u5305\u56f4\u8d77\u6765\u3002<\/p>\n<pre class=\"lang:delphi decode:true \">    [RequestMapping('\/view\/{uid}\/{uname}', http_GET)]\r\n    procedure ViewTest1(\r\n      [PathVariable('uid')] UID: Integer;\r\n      [PathVariable('uname')] const UName: string;\r\n      Response: TIocpHttpWriter);<\/pre>\n<p>&nbsp;<\/p>\n<p>\u793a\u4f8b\u4e2d\uff0c{uid}\u3001{uname} \u90fd\u662furl\u7ea7\u7684\u52a8\u6001\u53c2\u6570\u3002\u901a\u8fc7 PathVariable \u6807\u6ce8\u5c06\u5b83\u4eec\u5206\u522b\u7ed1\u5b9a\u5230\u4e86\u5904\u7406\u51fd\u6570 ViewTest1 \u7684\u53c2\u6570 UID \u548c UName \u4e0a\u3002\u5728\u89e6\u53d1 ViewTest1 \u65f6\uff0cUID \u7684\u503c\u5c31\u662f {uid} \uff0c UName \u5c31\u662f {uname} \u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>[RequestParam]<\/h2>\n<p>\u8fd9\u662f\u4e00\u4e2a\u53c2\u6570\u7ea7\u7684\u5c5e\u6027\u6807\u6ce8\u3002\u7528\u4e8e\u5c06\u8bf7\u6c42\u53c2\u6570\u533a\u6570\u636e\u6620\u5c04\u5230\u529f\u80fd\u5904\u7406\u65b9\u6cd5\u7684\u53c2\u6570\u4e0a\u3002\u5982\u679c\u5b9e\u9645URL\u4e2d\u53c2\u6570\u4e0d\u5b58\u5728\u65f6\uff0c\u4f1a\u5c06\u53c2\u6570\u7f6e\u4e3a\u7a7a\uff08\u5982\u6570\u5b57\u578b\u4f1a\u662f0\uff0c\u5b57\u7b26\u4e32\u4f1a\u662f\u7a7a\u4e32\uff09\u3002\u5982\u679c\u53c2\u6570\u7c7b\u578b\u4e0e\u5b9e\u9645\u4f20\u5165\u7684\u5185\u5bb9\u4e0d\u7b26\uff0c\u4f1a\u4ea7\u751f 500 \u9519\u8bef\u3002<\/p>\n<p>\u6b64\u6807\u6ce8\u6709\u5982\u4e0b\u51e0\u4e2a\u5c5e\u6027\uff1a<\/p>\n<ul>\n<li><strong>Name<\/strong>: \u53c2\u6570\u540d\u79f0\u3002<\/li>\n<\/ul>\n<pre class=\"lang:delphi decode:true \">    \/\/ \u8fd4\u56de\u4e00\u4e2a\u7f51\u9875\u540d\u79f0, \u4ee5\u4e0b\u8f7d\u65b9\u5f0f\r\n    \/\/ \u5904\u7406 URL: \/demo\/view4?uid=123456\r\n    [RequestMapping('\/view4', http_GET)]\r\n    function ViewTest4([RequestParam('uid')] UID: Integer): string;<\/pre>\n<p>\u793a\u4f8b\u4e2d\uff0c\u5f53 url \u662f http:\/\/host\/demo\/view4?uid=123456 \u65f6\uff0c \u89e6\u53d1 ViewTest4 \u65f6\uff0c\u53c2\u6570 UID \u7684\u503c\u4f1a\u662f 123456\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>[RequestBody]<\/h2>\n<p>\u8fd9\u662f\u4e00\u4e2a\u51fd\u6570\uff08\u65b9\u6cd5\uff09\u7ea7\u7684\u5c5e\u6027\u6807\u6ce8\u3002\u5b83\u7684\u4f5c\u7528\u5982\u4e0b\uff1a<\/p>\n<p>1. \u8bfb\u53d6Request\u8bf7\u6c42\u7684body\u90e8\u5206\u6570\u636e\uff0c\u4f7f\u7528\u7cfb\u7edf\u9ed8\u8ba4\u914d\u7f6e\u7684Converter\uff08\u8f6c\u6362\u5668\uff09\u8fdb\u884c\u89e3\u6790\uff0c\u7136\u540e\u628a\u76f8\u5e94\u7684\u6570\u636e\u7ed1\u5b9a\u5230\u8981\u8fd4\u56de\u7684\u5bf9\u8c61\u4e0a\uff1b<\/p>\n<p>2. \u518d\u628aConverter\u8fd4\u56de\u7684\u5bf9\u8c61\u6570\u636e\u7ed1\u5b9a\u5230controller\u4e2d\u65b9\u6cd5\u7684\u53c2\u6570\u4e0a\u3002<\/p>\n<p>\u793a\u4f8b\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">type\r\n  TUserData = record\r\n    UID: Integer;\r\n    Age: Integer;\r\n    Name: string;\r\n    Nick: string;\r\n  end;\r\n \r\n    ......\r\n\r\n   \/\/ \u63d0\u4ea4\u7528\u6237\u6570\u636e\r\n    \/\/ \u5904\u7406 URL: \/demo\/person\/profile\/reguser\r\n    [RequestMapping('\/person\/profile\/reguser')]\r\n    function RegUser([RequestBody] Data: TUserData): string;<\/pre>\n<p>\u5728\u89e6\u53d1 RegUser \u51fd\u6570\u65f6\uff0c \u8f6c\u6362\u5668\u4f1a\u5c06\u8bf7\u6c42\u7684\u6570\u636e\u6ce8\u5165 Data \u4e2d\u3002\u5728\u7f16\u5199\u8f6c\u6362\u5668\u65f6\uff0cGET\u8bf7\u6c42\u4e00\u822c\u9700\u8981\u5355\u72ec\u5904\u7406\u3002<\/p>\n<p>\u8f6c\u6362\u5668\u793a\u4f8b\uff1a<\/p>\n<p>\u8bbe\u7f6e HttpMvc.OnDeSerializeData \u4e8b\u4ef6\uff0c\u5728\u4e8b\u4ef6\u4e2d\u8fdb\u884c\u5904\u7406\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">\/\/ \u53cd\u5e8f\u5217\u5316\u5904\u7406\r\nfunction TForm1.DoDeSerializeData(Sender: TObject; const Value: string;\r\n  const Dest: TValue; IsGet: Boolean): Boolean;\r\nvar\r\n  Json: JSONObject;\r\n  S: AnsiString;\r\nbegin\r\n  if not IsGet then begin\r\n    Json := JSONObject.ParseObject(Value, False);\r\n    try\r\n      if Assigned(Json) then\r\n        TYxdSerialize.ReadValue(Json, Dest);\r\n    finally\r\n      FreeAndNil(Json);\r\n    end;\r\n  end else begin\r\n    \/\/ Get \u8bf7\u6c42\u5355\u72ec\u5904\u7406\r\n    Json := JSONObject.Create;\r\n    try\r\n      S := AnsiString(Value);\r\n      HttpMvc.Server.DecodeParam(PAnsiChar(S), Length(S), DoReadedItem, Json);\r\n      TYxdSerialize.ReadValue(Json, Dest);\r\n    finally\r\n      FreeAndNil(Json);\r\n    end;\r\n  end;\r\n  Result := True;\r\nend;<\/pre>\n<p>\u5728\u4e0a\u9762\u7684\u53cd\u5e8f\u5217\u5316\u64cd\u4f5c\u4e2d\uff0c Dest \u5b9e\u9645\u4e0a\u5c31\u662f\u6807\u6ce8\u4e86 RequestBody \u7684\u54cd\u5e94\u51fd\u6570\u4e2d\u7684\u6b63\u8981\u6ce8\u5165\u7684\u53c2\u6570\uff0c\u5728\u793a\u4f8b\u4e2d\u5c31\u662f Data: TUserData\u3002<\/p>\n<p>\u5982\u679c\u6709\u8fd9\u6837\u7684\u4e00\u4e2aPost\u8bf7\u6c42\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">POST \/demo\/person\/profile\/reguser HTTP\/1.1\r\nAccept: *\/*\r\nUser-Agent: Mozilla\/5.0 (Windows NT 5.1; rv:12.0) Gecko\/20100101 Firefox\/12.0\r\nContent-Type: text\/html; charset=GB2312\r\nAccept-Encoding: gzip, deflate\r\nContent-Length: 59\r\nAccept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3\r\nConnection: Keep-Alive\r\n\r\n{\"UID\":666,\"Age\":30,\"Name\":\"yangyxd\",\"Nick\":\"\\u55B5\\u55B5\"}<\/pre>\n<p>\u5728\u89e6\u53d1 RegUser \u65f6\uff0c \u53c2\u6570 Data \u7684\u503c\u4f1a\u662f\uff1a<\/p>\n<p>Name\u00a0\u00a0 \u00a0Value<br \/>\nData\u00a0\u00a0 \u00a0(666, 30, &#8216;yangyxd&#8217;, &#8216;\u55b5\u55b5&#8217;)<br \/>\n<img decoding=\"async\" src=\"http:\/\/images2015.cnblogs.com\/blog\/666150\/201610\/666150-20161025115502484-1227995402.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2>[ResponseBody]<\/h2>\n<p>\u8fd9\u662f\u4e00\u4e2a\u51fd\u6570\uff08\u65b9\u6cd5\uff09\u7ea7\u7684\u5c5e\u6027\u6807\u6ce8\u3002\u5b83\u7684\u4f5c\u7528\u5982\u4e0b\uff1a<\/p>\n<p>\u5c06Controller\u7684\u65b9\u6cd5\u8fd4\u56de\u7684\u5bf9\u8c61\uff0c\u901a\u8fc7\u9002\u5f53\u7684Converter\u7684Adapter\u8f6c\u6362\u5bf9\u8c61, \u5c06\u5185\u5bb9\u8f6c\u6362\u4e3a\u6307\u5b9a\u683c\u5f0f\u540e\uff0c\u5199\u5165\u5230Response\u5bf9\u8c61\u7684body\u6570\u636e\u533a\u3002<\/p>\n<pre class=\"lang:delphi decode:true \">    \/\/ \u6839\u636eUID\u67e5\u8be2\u7528\u6237\u4fe1\u606f\u3002\r\n    \/\/ \u5904\u7406 URL: \/demo\/person\/profile\/123456\r\n    [RequestMapping('\/person\/profile\/{id}', http_GET)]\r\n    [ResponseBody]\r\n    function Porfile([PathVariable('id')] UID: Integer): TPerson;<\/pre>\n<p>\u5728\u89e6\u53d1 Porfile \u51fd\u6570\u65f6\uff0c \u8fd4\u56de\u503c TPerson \u4f1a\u88ab\u8f6c\u6362\u5668\u8f6c\u6362\u5e8f\u5217\u5316\u4e3a\u6307\u5b9a\u683c\u5f0f\uff0c\u7136\u540e\u5199\u5165 Response \u5bf9\u8c61\uff0c \u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u3002<\/p>\n<p>\u8bbe\u7f6e HttpMvc.OnSerializeData \u4e8b\u4ef6\uff0c\u5728\u4e8b\u4ef6\u4e2d\u8fdb\u884c\u5904\u7406\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">\/\/ \u5e8f\u5217\u5316\u5904\u7406\r\nfunction TForm1.DoSerializeData(Sender: TObject; const Value: TValue): string;\r\nvar\r\n  Json: JSONObject;\r\nbegin\r\n  Json := JSONObject.Create;\r\n  try\r\n    TYxdSerialize.WriteValue(Json, '', Value);\r\n  finally\r\n    Result := Json.ToString();\r\n    Json.Free;\r\n  end;\r\nend;<\/pre>\n<p>\u5982\u679c\u5728 Porfile \u4e2d\u7684\u8fd4\u56de\u5185\u5bb9\u662f\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">function TMvcDemo.Porfile(UID: Integer): TPerson;\r\nbegin\r\n  Result.UID := UID;\r\n  Result.Name := 'Admin';\r\n  Result.Status := 100;\r\nend;<\/pre>\n<p>\u901a\u8fc7\u4f7f\u7528\u4e0a\u9762\u7684\u8f6c\u6362\u5668\uff0c \u5728\u89e6\u53d1 Porfile \u51fd\u6570\u540e\uff0c\u6d4f\u89c8\u5668\u6536\u5230\u7684\u6570\u636e\u4f1a\u662f\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">{\"UID\":123456,\"Name\":\"Admin\",\"Status\":100}<\/pre>\n<p>&nbsp;<\/p>\n<h1>\u4e8c\u3001\u6620\u5c04\u51fd\u6570\u8fd4\u56de\u503c<\/h1>\n<h2>\u666e\u901aWEB\u8bf7\u6c42\uff1a<\/h2>\n<p>\u65e0\u8fd4\u56de\u503c\u65f6\uff0c \u4f1a\u8fd4\u56de\u5ba2\u6237\u7aef 200 \u72b6\u6001\u3002<\/p>\n<p>\u8fd4\u56de\u5b57\u7b26\u4e32\u65f6\uff0c \u4f1a\u8fd4\u56de\u4e00\u4e2a\u00a0 Prefix + \u8fd4\u56de\u503c + Suffix \u7684\u6587\u4ef6\u3002\u5982\u679c\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u5219\u8fd4\u56de 404 \u9519\u8bef\u3002<\/p>\n<p>\u8fd4\u56de\u6574\u6570\u65f6\uff0c \u8ba4\u4e3a\u662f\u9519\u8bef\u4ee3\u7801\u3002\u6bd4\u5982\u8fd4\u56de 404\uff0c \u5219\u6d4f\u89c8\u5668\u4f1a\u6536\u5230 404 \u9519\u8bef\u3002<\/p>\n<p>\u8fd4\u56de\u5bf9\u8c61(Class) \u6216\u8bb0\u5f55\uff08Record)\u65f6\uff0c\u5982\u679c\u6807\u6ce8\u4e86ResponseBody\uff0c\u4f1a\u4f7f\u7528\u8f6c\u6362\u5668\u8f6c\u6362\u540e\u8f93\u51fa\u7ed9\u5ba2\u6237\u7aef\u3002\u5982\u679c\u6ca1\u6709\u6807\u6ce8 ResponseBody\uff0c \u5219\u76f4\u63a5\u8fd4\u56de 200 \u72b6\u6001\u3002\u5982\u679c\u8fd4\u56de\u7684\u662f\u5bf9\u8c61\uff0c\u4f1a\u81ea\u52a8\u91ca\u653e\u5bf9\u8c61\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>WebSocket \u8bf7\u6c42\uff1a<\/h2>\n<p>\u65e0\u8fd4\u56de\u503c\u65f6\uff0c \u670d\u52a1\u5668\u4e0d\u4f5c\u4efb\u4f55\u54cd\u5e94\u3002<\/p>\n<p>\u8fd4\u56de\u5b57\u7b26\u4e32\u65f6\uff0c\u4f1a\u76f4\u63a5\u5c06\u5b57\u7b26\u4e32\u53d1\u9001\u7ed9\u5ba2\u6237\u7aef\u3002<\/p>\n<p>\u8fd4\u56de\u6570\u636e\u65f6\uff0c\u4f1a\u5c06\u6570\u636e\u8f6c\u4e3a\u5b57\u7b26\u4e32\u540e\u53d1\u9001\u7ed9\u5ba2\u6237\u7aef\u3002<\/p>\n<p>\u8fd4\u56de\u5bf9\u8c61(Class) \u6216\u8bb0\u5f55\uff08Record)\u65f6\uff0c\u5982\u679c\u6807\u6ce8\u4e86ResponseBody\uff0c\u4f1a\u4f7f\u7528\u8f6c\u6362\u5668\u8f6c\u6362\u540e\u8f93\u51fa\u7ed9\u5ba2\u6237\u7aef\u3002\u5982\u679c\u6ca1\u6709\u6807\u6ce8 ResponseBody\uff0c \u670d\u52a1\u5668\u4e0d\u4f5c\u4efb\u4f55\u54cd\u5e94\u3002<\/p>\n<h1><\/h1>\n<h1>\u4e09\u3001 MVC \u670d\u52a1\u5668\u914d\u7f6e<\/h1>\n<p>\u5728\u7a97\u53e3\u4e0a\u653e\u7f6e TIocpHttpMvcServer \u7ec4\u4ef6\u65f6\uff0c \u901a\u8fc7\u7ec4\u4ef6\u5c5e\u6027\u9762\u677f\u8fdb\u884c\u8bbe\u7f6e\u3002<\/p>\n<p>\u4e0d\u4f7f\u7528 TIocpHttpMvcServer \u7ec4\u4ef6\u65f6\uff0c \u5f15\u7528 iocp.Http.Mvc \uff0c \u4f1a\u81ea\u52a8\u5f00\u542f MVC \u670d\u52a1\u3002\u6b64\u65f6\u4f1a\u81ea\u52a8\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6 &#8220;<span style=\"color: #ff6600\">http_mvc_setting.xml<\/span>&#8220;\u3002<\/p>\n<p>\u914d\u7f6e\u6587\u4ef6\u5e94\u5f53\u653e\u4e8e\u670d\u52a1\u7a0b\u5e8f\u76f8\u540c\u76ee\u5f55\u4e2d\uff0c\u6587\u4ef6\u540d\u4e3a &#8220;<span style=\"color: #ff6600\">http_mvc_setting.xml&#8221;<\/span>\u3002<\/p>\n<p><strong>\u914d\u7f6e\u6587\u4ef6\u793a\u4f8b\uff1a<\/strong><span style=\"color: #0000ff\"><br \/>\n<\/span><\/p>\n<pre class=\"lang:xhtml decode:true \">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;xml&gt;\r\n    &lt;ListenPort&gt;8081&lt;\/ListenPort&gt;\r\n    &lt;Active&gt;true&lt;\/Active&gt;\r\n    &lt;Charset&gt;UTF-8&lt;\/Charset&gt;\r\n    &lt;UseWebSocket&gt;false&lt;\/UseWebSocket&gt;\r\n    &lt;ContentLanguage\/&gt;\r\n    &lt;WebPath&gt;.\\Web\\&lt;\/WebPath&gt;\r\n    &lt;GzipFileTypes&gt;.htm;.html;.css;.js;.txt;.xml;.csv;.ics;.sgml;.c;.h;.pas;.cpp;.java;&lt;\/GzipFileTypes&gt;\r\n    &lt;AutoDecodePostParams&gt;true&lt;\/AutoDecodePostParams&gt;\r\n    &lt;UploadMaxDataSize&gt;2097152&lt;\/UploadMaxDataSize&gt;\r\n    &lt;AccessControlAllow&gt;\r\n        &lt;Enabled&gt;false&lt;\/Enabled&gt;\r\n        &lt;Origin&gt;*&lt;\/Origin&gt;\r\n        &lt;Methods&gt;POST, GET, OPTIONS&lt;\/Methods&gt;\r\n        &lt;Headers&gt;X-Requested-With, Content-Type&lt;\/Headers&gt;\r\n    &lt;\/AccessControlAllow&gt;\r\n&lt;\/xml&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>\u914d\u7f6e\u6587\u4ef6\u8bf4\u660e\uff1a<\/strong><\/p>\n<p>ListenPort\uff1a \u670d\u52a1\u5668\u76d1\u542c\u7aef\u53e3<\/p>\n<p>Active\uff1a \u662f\u5426\u5728\u7a0b\u5e8f\u8fd0\u884c\u540e\u81ea\u52a8\u5f00\u59cb\u670d\u52a1<\/p>\n<p>Charset\uff1a \u9ed8\u8ba4\u5b57\u7b26\u96c6<\/p>\n<p>UseWebSocket\uff1a \u662f\u5426\u4f7f\u7528WebSocket\u670d\u52a1<\/p>\n<p>ContentLanguage\uff1a \u9ed8\u8ba4\u5185\u5bb9\u8bed\u8a00<\/p>\n<p>WebPath\uff1a WEB\u670d\u52a1\u6587\u4ef6\u6839\u76ee\u5f55<\/p>\n<p>Prefix\uff1a \u8fd4\u56de\u89c6\u56fe\u7684\u524d\u7f00\u540d\u79f0\uff0c\u9ed8\u8ba4\u4e3a\u7a7a<\/p>\n<p>Suffix\uff1a \u8fd4\u56de\u89c6\u56fe\u7684\u540e\u7f00\u540d\u79f0\uff0c\u9ed8\u8ba4\u4e3a\u7a7a<\/p>\n<p>UriCaseSensitive\uff1a URI\u662f\u5426\u5927\u5c0f\u5199\u654f\u611f<\/p>\n<p>BindAddr\uff1a \u670d\u52a1\u5668\u7aef\u53e3\u7ed1\u5b9a\u5730\u5740\uff0c\u9ed8\u8ba4\u4e3a\u201c0.0.0.0\u201d<\/p>\n<p>GzipFileTypes\uff1a \u81ea\u52a8\u4f7f\u7528gzip\u538b\u7f29\u6570\u636e\u7684\u6587\u4ef6\u7c7b\u578b<\/p>\n<p>AutoDecodePostParams\uff1a \u81ea\u52a8\u89e3\u6790Post\u65b9\u5f0f\u4f20\u5165\u7684\u53c2\u6570<\/p>\n<p>UploadMaxDataSize\uff1a \u4e0a\u4f20\u6587\u4ef6\u7684\u6700\u5927\u5927\u5c0f\uff08\u5b57\u8282\uff09\u3002<\/p>\n<p>AccessControlAllow\uff1a WEB\u8bf7\u6c42\u8de8\u57df\u63a7\u5236\u9009\u9879\u3002<\/p>\n<p>Enabled\uff1a \u662f\u5426\u542f\u7528\u8de8\u57df\u63a7\u5236<\/p>\n<p>Origin\uff1a\u00a0\u5141\u8bb8\u54ea\u4e9burl\u53ef\u4ee5\u8de8\u57df\u8bf7\u6c42\u5230\u672c\u57df<\/p>\n<p>Methods\uff1a\u00a0\u5141\u8bb8\u7684\u8bf7\u6c42\u65b9\u6cd5<\/p>\n<p>Headers\uff1a\u00a0\u5141\u8bb8\u54ea\u4e9b\u8bf7\u6c42\u5934\u53ef\u4ee5\u8de8\u57df<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u5730\u5740\uff1a http:\/\/www.cnb [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[8],"tags":[450,405,678,677],"class_list":["post-4283","post","type-post","status-publish","format-standard","hentry","category-delphi","tag-delphi","tag-iocp","tag-mvc","tag-yxdiocp"],"views":7738,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/4283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4283"}],"version-history":[{"count":3,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/4283\/revisions"}],"predecessor-version":[{"id":4286,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/4283\/revisions\/4286"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}