{"id":150377,"date":"2020-09-02T21:06:56","date_gmt":"2020-09-02T13:06:56","guid":{"rendered":"http:\/\/4563.org\/?p=150377"},"modified":"2020-09-02T21:06:56","modified_gmt":"2020-09-02T13:06:56","slug":"%e4%b8%80%e6%ac%be%e7%9b%b4%e5%87%bb%e7%97%9b%e7%82%b9%e7%9a%84%e4%bc%98%e7%a7%80-http-%e6%a1%86%e6%9e%b6%ef%bc%8c%e8%ae%a9%e6%88%91%e8%b6%85%e9%ab%98%e6%95%88%e7%8e%87%e5%ae%8c%e6%88%90%e4%ba%86","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=150377","title":{"rendered":"\u4e00\u6b3e\u76f4\u51fb\u75db\u70b9\u7684\u4f18\u79c0 http \u6846\u67b6\uff0c\u8ba9\u6211\u8d85\u9ad8\u6548\u7387\u5b8c\u6210\u4e86\u548c\u7b2c\u4e09\u65b9\u63a5\u53e3\u7684\u5bf9\u63a5"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u4e00\u6b3e\u76f4\u51fb\u75db\u70b9\u7684\u4f18\u79c0 http \u6846\u67b6\uff0c\u8ba9\u6211\u8d85\u9ad8\u6548\u7387\u5b8c\u6210\u4e86\u548c\u7b2c\u4e09\u65b9\u63a5\u53e3\u7684\u5bf9\u63a5               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : bryan31 <\/span>  <span><i><\/i> 14<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u9996\u5148\uff0c\u6211\u662f\u6b64\u6587\u539f\u4f5c\u8005\uff0c\u53ef\u80fd\u6709\u540c\u5b66\u770b\u8fc7\u8fd9\u7bc7\u6587\u7ae0\u3002\u5728 V \u7ad9\u53ea\u662f\u4e3a\u4e86\u4ecb\u7ecd Forest \u8fd9\u4e2a\u795e\u5668\uff0c\u5e2e\u52a9\u5927\u5bb6\u5728\u5de5\u4f5c\u4e2d\u9009\u62e9 http \u5ba2\u6237\u7aef\u65f6\u591a\u4e00\u4e2a\u9009\u62e9\u3002\u671b\u5927\u5bb6\u79ef\u6781\u8ba8\u8bba\u3002<\/p>\n<h2>1.\u80cc\u666f<\/h2>\n<p>\u56e0\u4e3a\u4e1a\u52a1\u5173\u7cfb\uff0c\u8981\u548c\u8bb8\u591a\u4e0d\u540c\u7b2c\u4e09\u65b9\u516c\u53f8\u8fdb\u884c\u5bf9\u63a5\u3002\u8fd9\u4e9b\u670d\u52a1\u5546\u90fd\u63d0\u4f9b\u57fa\u4e8e http \u7684 api \u3002\u4f46\u662f\u6bcf\u5bb6\u516c\u53f8\u63d0\u4f9b api \u5177\u4f53\u7ec6\u8282\u5dee\u522b\u5f88\u5927\u3002\u6709\u7684\u57fa\u4e8e<code>RESTFUL<\/code>\u89c4\u8303\uff0c\u6709\u7684\u57fa\u4e8e\u4f20\u7edf\u7684 http \u89c4\u8303\uff1b\u6709\u7684\u9700\u8981\u5728<code>header<\/code>\u91cc\u653e\u7f6e\u7b7e\u540d\uff0c\u6709\u7684\u9700\u8981<code>SSL<\/code>\u7684\u53cc\u5411\u8ba4\u8bc1\uff0c\u6709\u7684\u53ea\u9700\u8981<code>SSL<\/code>\u7684\u5355\u5411\u8ba4\u8bc1\uff1b\u6709\u7684\u4ee5<code>JSON<\/code> \u65b9\u5f0f\u8fdb\u884c\u5e8f\u5217\u5316\uff0c\u6709\u7684\u4ee5<code>XML<\/code>\u65b9\u5f0f\u8fdb\u884c\u5e8f\u5217\u5316\u3002\u7c7b\u4f3c\u4e8e\u8fd9\u6837\u7ec6\u8282\u7684\u5dee\u522b\u592a\u591a\u4e86\u3002<\/p>\n<p>\u4e0d\u540c\u7684\u516c\u53f8 API \u89c4\u8303\u4e0d\u4e00\u6837\uff0c\u8fd9\u5f88\u6b63\u5e38\u3002\u4f46\u662f\u5bf9\u4e8e\u6211\u6765\u8bf4\uff0c\u6211\u5982\u679c\u60f3\u8981\u4ee3\u7801\u53d8\u5f97\u4f18\u96c5\u3002\u6211\u5c31\u5fc5\u987b\u89e3\u51b3\u4e00\u4e2a\u75db\u70b9\uff1a<\/p>\n<p><strong>\u4e0d\u540c\u670d\u52a1\u5546 API \u90a3\u4e48\u591a\u7684\u5dee\u5f02\u70b9\uff0c\u5982\u4f55\u624d\u80fd\u7ef4\u62a4\u4e00\u5957\u4e0d\u6d89\u53ca\u4e1a\u52a1\u7684\u516c\u5171 http \u8c03\u7528\u5957\u4ef6\u3002\u6700\u597d\u901a\u8fc7\u914d\u7f6e\u6216\u8005\u7b80\u5355\u7684\u53c2\u6570\u5c31\u80fd\u533a\u5206\u5f00\u6765\u3002\u8fdb\u884c\u65b9\u4fbf\u7684\u8c03\u7528\uff1f<\/strong><\/p>\n<p>\u6211\u5f53\u7136\u77e5\u9053\u6709\u5f88\u591a\u4f18\u79c0\u7684\u5927\u540d\u9f0e\u9f0e\u7684 http \u5f00\u6e90\u6846\u67b6\u53ef\u4ee5\u5b9e\u73b0\u4efb\u4f55\u5f62\u5f0f\u7684 http \u8c03\u7528\uff0c\u5728\u591a\u5e74\u7684\u5f00\u53d1\u7ecf\u9a8c\u4e2d\u6211\u90fd\u6709\u4f7f\u7528\u8fc7\u3002\u6bd4\u5982<code>apache<\/code>\u7684<code>httpClient<\/code>\u5305\uff0c\u975e\u5e38\u4f18\u79c0\u7684<code>Okhttp<\/code>\uff0c<code>jersey client<\/code>\u3002<\/p>\n<p>\u8fd9\u4e9b<code>http<\/code>\u5f00\u6e90\u6846\u67b6\u7684\u63a5\u53e3\u4f7f\u7528\u76f8\u5bf9\u6765\u8bf4\uff0c\u90fd\u4e0d\u592a\u4e00\u6837\u3002\u4e0d\u7ba1\u9009\u54ea\u4e2a\uff0c\u5728\u6211\u8fd9\u4e2a\u573a\u666f\u91cc\u6765\u8bf4\uff0c\u6211\u90fd\u4e0d\u5e0c\u671b\u5728\u8c03\u7528\u6bcf\u4e2a\u7b2c\u4e09\u65b9\u7684 http api \u65f6\u5199\u4e0a\u4e00\u5806 http \u8c03\u7528\u4ee3\u7801\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u5728\u8fd9\u4e2a\u573a\u666f\u91cc\uff0c\u6211\u5f97\u5bf9\u6bcf\u79cd\u4e0d\u540c\u7684 http api \u8fdb\u884c\u5c01\u88c5\u3002\u8fd9\u6837\u7684\u4ee3\u7801\u624d\u80fd\u66f4\u52a0\u4f18\u96c5\uff0c\u4e1a\u52a1\u4ee3\u7801\u548c http \u8c03\u7528\u903b\u8f91\u8026\u5408\u5ea6\u66f4\u4f4e\u3002<\/p>\n<p>\u53ef\u60dc\uff0c\u6211\u6bd4\u8f83\u61d2\u3002\u4e00\u6765\u89c9\u5f97\u5c01\u88c5\u8d77\u6765\u6bd4\u8f83\u8d39\u65f6\u95f4\uff0c\u4e8c\u6765\u89c9\u5bf9\u5c01\u88c5\u8fd9\u79cd\u5e95\u5c42 http \u8c03\u7528\u6765\u8bf4\uff0c\u5e94\u8be5\u6709\u66f4\u597d\u7684\u9009\u62e9\u3002\u4e0d\u60f3\u81ea\u5df1\u518d\u53bb\u9020\u8f6e\u5b50\u3002<\/p>\n<p><strong>\u4e8e\u662f\uff0c\u6211\u53d1\u73b0\u4e86\u4e00\u6b3e\u4f18\u79c0\u7684\u5f00\u6e90 http \u6846\u67b6\uff0c\u80fd\u5c4f\u853d\u4e0d\u540c\u7ec6\u8282 http api \u6240\u5e26\u6765\u7684\u6240\u6709\u5dee\u5f02\u3002\u80fd\u901a\u8fc7\u7b80\u5355\u7684\u914d\u7f6e\u50cf\u8c03\u7528 rpc \u6846\u67b6\u4e00\u6837\u7684\u53bb\u5b8c\u6210\u6781\u4e3a\u590d\u6742\u7684 http \u8c03\u7528\u3002<\/strong><\/p>\n<p><strong>Forest<\/strong><\/p>\n<blockquote>\n<p>https:\/\/gitee.com\/dt_flys\/forest<\/p>\n<\/blockquote>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/09\/20200906_5f5439e1ad4fc.png\" alt=\"\u4e00\u6b3e\u76f4\u51fb\u75db\u70b9\u7684\u4f18\u79c0 http \u6846\u67b6\uff0c\u8ba9\u6211\u8d85\u9ad8\u6548\u7387\u5b8c\u6210\u4e86\u548c\u7b2c\u4e09\u65b9\u63a5\u53e3\u7684\u5bf9\u63a5\" \/><\/p>\n<h2>2.\u4e0a\u624b<\/h2>\n<p><code>Forest<\/code>\u652f\u6301\u4e86<code>Springboot<\/code>\u7684\u81ea\u52a8\u88c5\u914d\uff0c\u6240\u4ee5\u53ea\u9700\u8981\u5f15\u5165\u4e00\u4e2a\u4f9d\u8d56\u5c31\u884c<\/p>\n<pre><code>&lt;dependency&gt;   &lt;groupId&gt;com.dtflys.forest&lt;\/groupId&gt;   &lt;artifactId&gt;spring-boot-starter-forest&lt;\/artifactId&gt;   &lt;version&gt;1.4.0&lt;\/version&gt; &lt;\/dependency&gt; <\/code><\/pre>\n<p>\u5b9a\u4e49\u81ea\u5df1\u7684\u63a5\u53e3\u7c7b<\/p>\n<pre><code>public interface MyClient {      @Request(url = \"http:\/\/baidu.com\")     String simpleRequest();      @Request(             url = \"http:\/\/ditu.amap.com\/service\/regeo\",             dataType = \"json\"     )     Map getLocation(@DataParam(\"longitude\") String longitude, @DataParam(\"latitude\") String latitude);    } <\/code><\/pre>\n<p>\u5728\u542f\u52a8\u7c7b\u91cc\u914d\u7f6e\u4ee3\u7406\u63a5\u53e3\u7c7b\u7684\u626b\u63cf\u5305<\/p>\n<pre><code>@SpringBootApplication @ForestScan(basePackages = \"com.example.demo.forest\") public class DemoApplication {     public static void main(String[] args) {         SpringApplication.run(DemoApplication.class, args);     } } <\/code><\/pre>\n<p>\u8fd9\u65f6\u5019\uff0c\u4f60\u5c31\u53ef\u4ee5\u4ece spring \u5bb9\u5668\u4e2d\u6ce8\u5165\u4f60\u7684\u4ee3\u7406\u63a5\u53e3\uff0c\u50cf\u8c03\u7528\u672c\u5730\u65b9\u6cd5\u4e00\u6837\u53bb\u8c03\u7528 http \u7684 api \u4e86<\/p>\n<pre><code>@Autowired private MyClient myClient;  @Override public void yourMethod throws Exception {     Map result = myClient.getLocation(\"124.730329\",\"31.463683\");     System.out.println(JSON.toJSONString(result,true)); } <\/code><\/pre>\n<p>\u65e5\u5fd7\u6253\u5370\uff0c<code>Forest<\/code>\u6253\u5370\u4e86\u5185\u90e8\u6240\u7528\u7684 http \u6846\u67b6\uff0c\u548c\u5b9e\u9645\u8bf7\u6c42 url \u548c\u8fd4\u56de\u3002\u5f53\u7136\u65e5\u5fd7\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u53bb\u63a7\u5236\u5f00\u5173\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/09\/20200906_5f5439e2c741e.png\" alt=\"\u4e00\u6b3e\u76f4\u51fb\u75db\u70b9\u7684\u4f18\u79c0 http \u6846\u67b6\uff0c\u8ba9\u6211\u8d85\u9ad8\u6548\u7387\u5b8c\u6210\u4e86\u548c\u7b2c\u4e09\u65b9\u63a5\u53e3\u7684\u5bf9\u63a5\" \/><\/p>\n<h2>3.\u7279\u70b9<\/h2>\n<p>\u6211\u89c9\u5f97\u5bf9\u4e8e\u5c24\u5176\u662f\u505a\u5bf9\u63a5\u7b2c\u4e09\u65b9 api \u7684\u5f00\u53d1\u540c\u5b66\u6765\u8bf4\uff0c\u8fd9\u6b3e\u5f00\u6e90\u6846\u67b6\u80fd\u5e2e\u4f60\u63d0\u9ad8\u5f88\u591a\u6548\u7387\u3002<\/p>\n<p><code>Forest<\/code> \u5e95\u5c42\u5c01\u88c5\u4e86 2 \u79cd\u4e0d\u540c\u7684 http \u6846\u67b6\uff1a<code>Apache httpClient<\/code>\u548c<code>OKhttp<\/code>\u3002\u6240\u4ee5\u8fd9\u4e2a\u5f00\u6e90\u6846\u67b6\u5e76\u6ca1\u6709\u5bf9\u5e95\u5c42\u5b9e\u73b0\u8fdb\u884c\u91cd\u590d\u9020\u8f6e\u5b50\uff0c\u800c\u662f\u5728\u6613\u7528\u6027\u4e0a\u9762\u4e0b\u8db3\u4e86\u529f\u592b\u3002<\/p>\n<p>\u6211\u7528<code>Forest<\/code>\u6700\u7ec8\u5b8c\u6210\u4e86\u548c\u591a\u4e2a\u670d\u52a1\u5546 api \u5bf9\u63a5\u7684\u9879\u76ee\uff0c\u8fd9\u4e9b\u98ce\u683c\u8fe5\u5f02\u7684 API\uff0c\u6211\u4ec5\u7528\u4e86 1 \u4e2a\u5c0f\u65f6\u65f6\u95f4\u5c31\u628a\u4ed6\u4eec\u8f6c\u5316\u4e3a\u4e86\u672c\u5730\u65b9\u6cd5\u3002\u7136\u540e\u9879\u76ee\u987a\u5229\u4e0a\u7ebf\u3002<\/p>\n<p><code>Forest<\/code>\u4f5c\u4e3a\u4e00\u6b3e\u66f4\u52a0\u9ad8\u5c42\u7684 http \u6846\u67b6\uff0c\u5176\u5b9e\u4f60\u5e76\u4e0d\u9700\u8981\u5199\u5f88\u591a\u4ee3\u7801\uff0c\u5927\u591a\u6570\u65f6\u5019\uff0c\u4f60\u4ec5\u901a\u8fc7\u4e00\u4e9b\u914d\u7f6e\u5c31\u80fd\u5b8c\u6210 http \u7684\u672c\u5730\u5316\u8c03\u7528\u3002\u800c\u8fd9\u4e2a\u6846\u67b6\u6240\u80fd\u8986\u76d6\u7684\u9762\uff0c\u5374\u975e\u5e38\u4e4b\u5e7f\uff0c\u6ee1\u8db3\u4f60\u7edd\u5927\u591a\u6570\u7684 http \u8c03\u7528\u8bf7\u6c42\u3002<\/p>\n<p><code>Forest<\/code>\u6709\u4ee5\u4e0b\u7279\u70b9\uff1a<\/p>\n<ul>\n<li>\u4ee5<code>Httpclient<\/code>\u548c<code>OkHttp<\/code>\u4e3a\u540e\u7aef\u6846\u67b6<\/li>\n<li>\u901a\u8fc7\u8c03\u7528\u672c\u5730\u65b9\u6cd5\u7684\u65b9\u5f0f\u53bb\u53d1\u9001 Http \u8bf7\u6c42, \u5b9e\u73b0\u4e86\u4e1a\u52a1\u903b\u8f91\u4e0e Http \u534f\u8bae\u4e4b\u95f4\u7684\u89e3\u8026<\/li>\n<li>\u76f8\u6bd4 Feign \u66f4\u8f7b\u91cf\uff0c\u4e0d\u4f9d\u8d56<code>Spring Cloud<\/code>\u548c\u4efb\u4f55\u6ce8\u518c\u4e2d\u5fc3<\/li>\n<li>\u652f\u6301\u6240\u6709\u8bf7\u6c42\u65b9\u6cd5\uff1a<code>GET<\/code>, <code>HEAD<\/code>, <code>OPTIONS<\/code>, <code>TRACE<\/code>, <code>POST<\/code>, <code>DELETE<\/code>, <code>PUT<\/code>, <code>PATCH<\/code><\/li>\n<li>\u652f\u6301\u7075\u6d3b\u7684\u6a21\u677f\u8868\u8fbe\u5f0f<\/li>\n<li>\u652f\u6301\u8fc7\u6ee4\u5668\u6765\u8fc7\u6ee4\u4f20\u5165\u7684\u6570\u636e<\/li>\n<li>\u57fa\u4e8e\u6ce8\u89e3\u3001\u914d\u7f6e\u5316\u7684\u65b9\u5f0f\u5b9a\u4e49<code>Http<\/code>\u8bf7\u6c42<\/li>\n<li>\u652f\u6301<code>Spring<\/code>\u548c<code>Springboot<\/code>\u96c6\u6210<\/li>\n<li>\u5b9e\u73b0<code>JSON<\/code>\u548c<code>XML<\/code>\u7684\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316<\/li>\n<li>\u652f\u6301 JSON \u8f6c\u6362\u6846\u67b6: <code>Fastjson<\/code>,<code>Jackson<\/code>, <code>Gson<\/code><\/li>\n<li>\u652f\u6301<code>JAXB<\/code>\u5f62\u5f0f\u7684<code>XML<\/code>\u8f6c\u6362<\/li>\n<li>\u652f\u6301<code>SSL<\/code>\u7684\u5355\u5411\u548c\u53cc\u5411\u52a0\u5bc6<\/li>\n<li>\u652f\u6301 http \u8fde\u63a5\u6c60\u7684\u8bbe\u5b9a<\/li>\n<li>\u53ef\u4ee5\u901a\u8fc7<code>OnSuccess<\/code>\u548c<code>OnError<\/code>\u63a5\u53e3\u53c2\u6570\u5b9e\u73b0\u8bf7\u6c42\u7ed3\u679c\u7684\u56de\u8c03<\/li>\n<li>\u914d\u7f6e\u7b80\u5355\uff0c\u4e00\u822c\u53ea\u9700\u8981<code>@Request<\/code>\u4e00\u4e2a\u6ce8\u89e3\u5c31\u80fd\u5b8c\u6210\u7edd\u5927\u591a\u6570\u8bf7\u6c42\u7684\u5b9a\u4e49<\/li>\n<li>\u652f\u6301\u5f02\u6b65\u8bf7\u6c42\u8c03\u7528<\/li>\n<\/ul>\n<h2>4.\u4e24\u4e2a\u5f88\u68d2\u7684\u529f\u80fd<\/h2>\n<p>\u8fd9\u91cc\u4e0d\u5bf9\u4f7f\u7528\u65b9\u5f0f\u548c\u914d\u7f6e\u65b9\u5f0f\u4e00\u4e00\u63cf\u8ff0\uff0c\u6709\u5174\u8da3\u7684\u53ef\u4ee5\u53bb\u9605\u8bfb\u8be6\u7ec6\u6587\u6863\uff1a<\/p>\n<blockquote>\n<p>https:\/\/dt_flys.gitee.io\/forest<\/p>\n<\/blockquote>\n<p>\u8fd9\u91cc\u53ea\u60f3\u5206\u6790\u8fd9\u4e2a\u6846\u67b6 2 \u4e2a\u6211\u8ba4\u4e3a\u6bd4\u8f83\u597d\u7684\u529f\u80fd<\/p>\n<h3>4.1 <strong>\u6a21\u677f\u8868\u8fbe\u5f0f\u548c\u53c2\u6570\u7684\u6620\u5c04\u7ed1\u5b9a\u529f\u80fd<\/strong><\/h3>\n<p>\u6a21\u677f\u8868\u8fbe\u5f0f\u5728\u4f7f\u7528\u7684\u65f6\u5019\u7279\u522b\u65b9\u4fbf\uff0c\u4e3e\u4e2a\u6817\u5b50<\/p>\n<pre><code>@Request(     url = \"${0}\/send?un=${1}&amp;pw=${2}&amp;ph=${3}&amp;ct=${4}\",     type = \"get\",     dataType = \"json\" ) public Map send(     String base,     String userName,     String password,     String phone,     String content ); <\/code><\/pre>\n<p>\u4e0a\u8ff0\u662f\u7528\u5e8f\u53f7\u4e0b\u6807\u8fdb\u884c\u53d6\u503c\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7\u540d\u5b57\u8fdb\u884c\u53d6\u503c\uff1a<\/p>\n<pre><code> @Request(     url = \"${base}\/send?un=${un}&amp;pw=${pw}&amp;ph=${3}&amp;ct=${ct}\",     type = \"get\",     dataType = \"json\" ) public Map send(     @DataVariable(\"base\") String base,     @DataVariable(\"un\") String userName,     @DataVariable(\"pw\") String password,     @DataVariable(\"ph\") String phone,     @DataVariable(\"ct\") String content ); <\/code><\/pre>\n<p>\u751a\u81f3\u4e8e\u53ef\u4ee5\u8fd9\u6837\u7b80\u5316\u5199\uff1a<\/p>\n<pre><code>@Request(     url = \"${base}\/send\",     type = \"get\",     dataType = \"json\" ) public Map send(     @DataVariable(\"base\") String base,     @DataParam(\"un\") String userName,     @DataParam(\"pw\") String password,     @DataParam(\"ph\") String phone,     @DataParam(\"ct\") String content ); <\/code><\/pre>\n<p><strong>\u4ee5\u4e0a\u4e09\u79cd\u5199\u6cd5\u662f\u7b49\u4ef7\u7684<\/strong><\/p>\n<p>\u5f53\u7136\u4f60\u4e5f\u53ef\u4ee5\u628a\u53c2\u6570\u7ed1\u5b9a\u5230 header \u548c body \u91cc\u53bb\uff0c\u4f60\u751a\u81f3\u4e8e\u53ef\u4ee5\u7528\u4e00\u4e9b\u8868\u8fbe\u5f0f\u7b80\u5355\u7684\u628a\u5bf9\u8c61\u5e8f\u5217\u5316\u6210 json \u6216\u8005 xml\uff1a<\/p>\n<pre><code>@Request(     url = \"${base}\/pay\",    contentType = \"application\/json\",     type = \"post\",     dataType = \"json\",     headers = {\"Authorization: ${1}\"},     data = \"${json($0)}\" ) public PayResponse pay(PayRequest request, String auth); <\/code><\/pre>\n<p>\u5f53\u7136\u6570\u636e\u7ed1\u5b9a\u8fd9\u5757\u8be6\u60c5\u8bf7\u53c2\u9605\u6587\u6863<\/p>\n<h3>4.2 \u5bf9<code>HTTPS<\/code>\u7684\u652f\u6301<\/h3>\n<p>\u4ee5\u524d\u7528\u5176\u4ed6 http \u6846\u67b6\u5904\u7406 https \u7684\u65f6\u5019\uff0c\u603b\u89c9\u5f97\u7279\u522b\u9ebb\u70e6\uff0c\u5c24\u5176\u662f\u53cc\u5411\u8bc1\u4e66\u3002\u6bcf\u6b21\u78b0\u5230\u95ee\u9898\u4e5f\u53ea\u80fd\u53bb baidu \u3002\u7136\u540e\u6839\u636e\u522b\u4eba\u7684\u7ecf\u9a8c\u6765\u4fee\u6539\u81ea\u5df1\u7684\u4ee3\u7801\u3002<\/p>\n<p><code>Forest<\/code>\u5bf9\u4e8e\u8fd9\u65b9\u9762\u4e5f\u60f3\u7684\u5f88\u5468\u5230\uff0c\u5e95\u5c42\u5b8c\u7f8e\u5c01\u88c5\u4e86\u5bf9 https \u5355\u53cc\u5411\u8bc1\u4e66\u7684\u652f\u6301\u3002\u4e5f\u662f\u53ea\u8981\u901a\u8fc7\u7b80\u5355\u7684\u914d\u7f6e\u5c31\u80fd\u8fc5\u901f\u5b8c\u6210\u3002\u4e3e\u4e2a\u53cc\u5411\u8bc1\u4e66\u6817\u5b50\uff1a<\/p>\n<pre><code>@Request(     url = \"${base}\/pay\",    contentType = \"application\/json\",     type = \"post\",     dataType = \"json\",    keyStore = \"pay-keystore\",    data = \"${json($0)}\" ) public PayResponse pay(PayRequest request); <\/code><\/pre>\n<p>\u5176\u4e2d<code>pay-keystore<\/code>\u5bf9\u5e94\u7740<code>application.yml<\/code>\u91cc\u7684<code>ssl-key-stores<\/code><\/p>\n<pre><code>forest:   ...   ssl-key-stores:     - id: pay-keystore       file: test.keystore       keystore-pass: 123456       cert-pass: 123456       protocols: SSLv3 <\/code><\/pre>\n<p>\u8fd9\u6837\u8bbe\u7f6e\uff0c\u5c31 ok \u4e86\uff0c\u5269\u4e0b\u7684\uff0c\u5c31\u662f\u672c\u5730\u4ee3\u7801\u5f62\u5f0f\u7684\u8c03\u7528\u4e86\u3002<\/p>\n<h2>5.\u6700\u540e<\/h2>\n<p><code>Forest<\/code>\u6709\u5f88\u591a\u5176\u4ed6\u7684\u529f\u80fd\u8bbe\u5b9a\uff0c\u5982\u679c\u611f\u5174\u8da3\u7684\u540c\u5b66\u8fd8\u8bf7\u4ed4\u7ec6\u53bb\u9605\u8bfb\u6587\u6863\u548c\u793a\u4f8b\u3002<\/p>\n<p>\u4f46\u662f\u6211\u60f3\u8bf4\u7684\u662f\uff0c\u76f8\u4fe1\u770b\u5230\u8fd9\u91cc\uff0c\u5f88\u591a\u4eba\u4e00\u5b9a\u4f1a\u8bf4\uff0c\u8fd9\u4e0d\u5c31\u662f<code>Feign<\/code>\u5417\uff1f<\/p>\n<p>\u6211\u5728\u5f00\u53d1<code>Spring Cloud<\/code>\u9879\u76ee\u7684\u65f6\u5019\uff0c\u4e5f\u7528\u8fc7\u4e00\u6bb5\u65f6\u95f4<code>Feign<\/code>\uff0c\u4e2a\u4eba\u611f\u89c9<code>Forest<\/code>\u7684\u786e\u5728\u914d\u7f6e\u548c\u7528\u6cd5\u4e0a\u548c<code>Feign<\/code>\u7684\u8bbe\u8ba1\u5f88\u50cf\uff0c\u4f46<code>Feign<\/code>\u7684\u89d2\u8272\u66f4\u591a\u662f\u4f5c\u4e3a<code>Spring Cloud<\/code>\u751f\u6001\u91cc\u7684\u4e00\u4e2a\u6210\u5458\u3002\u5145\u5f53 RPC \u901a\u4fe1\u7684\u89d2\u8272\uff0c\u5176\u627f\u62c5\u7684\u4e0d\u4ec5\u662f http \u901a\u8baf\uff0c\u8fd8\u8981\u5bf9\u6ce8\u518c\u4e2d\u5fc3\u4e0b\u53d1\u7684\u8c03\u7528\u5730\u5740\u8fdb\u884c\u8d1f\u8f7d\u5747\u8861\u3002<\/p>\n<p>\u800c<code>Forest<\/code>\u8fd9\u4e2a\u5f00\u6e90\u9879\u76ee\u5176\u5b9a\u4f4d\u5219\u662f\u4e00\u4e2a\u9ad8\u9636\u7684 http \u5de5\u5177\uff0c\u4e3b\u6253\u53cb\u597d\u548c\u6613\u7528\u6027\u3002\u4ece\u4f7f\u7528\u89d2\u5ea6\u51fa\u53d1\uff0c\u4e2a\u4eba\u611f\u89c9<code>Forest<\/code>\u914d\u7f6e\u6027\u66f4\u52a0\u7b80\u5355\u76f4\u63a5\u3002\u63d0\u4f9b\u7684\u5f88\u591a\u529f\u80fd\u4e5f\u80fd\u89e3\u51b3\u5f88\u591a\u4eba\u7684\u75db\u70b9\u3002<\/p>\n<p>\u5f00\u6e90\u7cbe\u795e\u96be\u80fd\u53ef\u8d35\uff0c\u597d\u7684\u5f00\u6e90\u9700\u8981\u5927\u5bb6\u7684\u6dfb\u7816\u52a0\u74e6\u548c\u652f\u6301\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u7ed9\u5927\u5bb6\u5728\u9009\u62e9 http \u5ba2\u6237\u7aef\u6846\u67b6\u65f6\u5e26\u6765\u4e00\u4e2a\u65b0\u7684\u9009\u62e9\uff1a<code>Forest<\/code><\/p>\n<h2>6.\u8054\u7cfb\u4f5c\u8005<\/h2>\n<p>\u89c9\u5f97\u6709\u7528\u7684\u8bdd\uff0c\u8bf7\u5173\u6ce8\u4e0b\u6211\u7684\u516c\u4f17\u53f7\u300c\u5143\u4eba\u90e8\u843d\u300d\uff0c\u4f5c\u8005\u575a\u6301\u539f\u521b\u7684\u5185\u5bb9\u6280\u672f\u5206\u4eab\uff0c\u4e5f\u6709\u5f00\u6e90\u4f5c\u54c1\uff0c\u6b22\u8fce\u5173\u6ce8<\/p>\n<p>\u5f00\u6e90\u4ed3\u5e93\u4e3a\uff1a https:\/\/gitee.com\/bryan31<\/p>\n<p>\u516c\u4f17\u53f7\u4e00\u822c\u5468\u66f4\uff0c\u6bcf\u6b21\u4f1a\u5206\u4eab\u4e00\u4e9b\u5b9e\u7528\u7684\u6280\u672f\uff0c\u966a\u4f60\u4e00\u8d77\u6210\u957f<\/p>\n<p>\u5173\u6ce8\u540e\u56de\u590d\u201c\u8d44\u6599\u201d\u9886\u53d6 50G \u7684\u89c6\u9891\u8d44\u6599\uff0c\u5305\u62ec\u4e00\u5957\u4f01\u4e1a\u7ea7\u5fae\u670d\u52a1\u7684\u89c6\u9891\u6559\u5b66<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/09\/20200906_5f5439e3aa4d6.jpg\" alt=\"\u4e00\u6b3e\u76f4\u51fb\u75db\u70b9\u7684\u4f18\u79c0 http \u6846\u67b6\uff0c\u8ba9\u6211\u8d85\u9ad8\u6548\u7387\u5b8c\u6210\u4e86\u548c\u7b2c\u4e09\u65b9\u63a5\u53e3\u7684\u5bf9\u63a5\" \/><\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3091985\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gz911122 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u8fd9\u4e2a\u6ce8\u89e3,\u611f\u89c9\u4e0d\u5982 retrofit \u554a<br \/>\u4e11\u4e86\u5f88\u591a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3091986\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : qmzhixu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u611f\u89c9\u5c01\u88c5\u5ea6\u592a\u9ad8\u4e86\uff0c\u8fd8\u662f okhttp \u7b80\u5355\uff0c\u8c03\u8bd5\u4e5f\u65b9\u4fbf                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3091987\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : BBCCBB <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u611f\u89c9\u548c feign \u4e00\u6837\u7684&#8230;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3091988\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sagaxu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1. \u652f\u6301\u5f02\u6b65\u5417\uff1f\u8fde\u63a5\u6c60\u5462\uff1f<br \/>2. \u80fd\u4e0d\u80fd\u8131\u79bb spring \u5355\u72ec\u4f7f\u7528?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3091989\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : bryan31 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @sagaxu \u90fd\u53ef\u4ee5\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3091990\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zzl22100048 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u7c7b\u7684\u6709\u5f88\u591a\uff0cResteasy client\uff0cfeign\uff0cMicroprofile RestClient\uff0c\u90fd\u662f\u7528\u63a5\u53e3\u4ee3\u7406\u8bf7\u6c42                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3091991\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jones2000 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6ca1\u4ec0\u4e48\u7279\u8272\uff0c\u53ea\u662f\u5c01\u88c5\u4e00\u4e0b\uff0c \u90fd\u662f\u91cd\u590d\u52b3\u52a8\u3002 <br \/>\u4f60\u65e2\u7136\u662f\u5c01\u88c5\u4e86\u7b2c 3 \u65b9 api\uff0c \u90a3\u662f\u4e0d\u662f\u53ef\u4ee5\u5bf9\u591a\u4e2a\u7b2c 3 \u653e api \u8fdb\u884c\u6570\u636e\u96c6\u7684\u7b5b\u9009\u8fc7\u6ee4\u64cd\u4f5c\u5462\u3002<br \/>\u5982\u679c \u63a5\u53e3 1 \u662f\u56fd\u5185\u6bcf\u4e2a\u7701\u7684 GDP \u6570\u636e\uff0c \u63a5\u53e3 2 \u662f\u53d6\u56fd\u5185\u6bcf\u4e2a\u7701\u7684\u4eba\u53e3\u51fa\u751f\u7387\u3002 \u4f60\u7684\u63d2\u4ef6\u662f\u5426\u53ef\u4ee5\u81ea\u52a8\u751f\u6210 GDP&gt;3% \u4eba\u53e3\u51fa\u751f\u7387&gt;4W \u7684\u6570\u636e api \u3002<br \/>\u8fd9\u6837\u624d\u80fd\u51cf\u5c11 api \u7684\u5f00\u53d1\uff0c \u901a\u8fc7\u81ea\u52a8\u5316\u751f\u6210 api \u6570\u636e\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3091992\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gz911122 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @bryan31 \u53ef\u4ee5\u5199\u4e0b\u548c retrofit \u7684\u4f18\u7f3a\u70b9\u5bf9\u6bd4.<br \/>\u6bd5\u7adf retrofit \u662f java \u9886\u57df\u8fd9\u65b9\u9762 star \u6700\u9ad8\u7684\u5f00\u6e90\u9879\u76ee, \u4e0d\u8fc7\u4e0d\u80fd\u505a\u5230\u67d0\u4e9b\u65b9\u9762\u66f4\u4f18\u79c0, \u90a3\u4e48\u6ca1\u4ec0\u4e48\u610f\u4e49                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3091993\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : vate32 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u503c\u5f97\u5173\u6ce8\u4e00\u6ce2                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u6b3e\u76f4\u51fb\u75db\u70b9\u7684\u4f18\u79c0 http \u6846\u67b6&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/150377"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=150377"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/150377\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=150377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=150377"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=150377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}