{"id":876,"date":"2010-09-11T16:36:31","date_gmt":"2010-09-11T08:36:31","guid":{"rendered":"http:\/\/www.impjq.net\/?p=876"},"modified":"2010-09-11T16:36:31","modified_gmt":"2010-09-11T08:36:31","slug":"%e5%88%a9%e7%94%a8httpclient%e7%99%bb%e5%bd%95%e6%a0%a1%e5%86%85","status":"publish","type":"post","link":"https:\/\/pjq.me\/?p=876","title":{"rendered":"\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185"},"content":{"rendered":"<p>\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185<br \/>\n<a href=\"https:\/\/docs.google.com\/document\/pub?id=1VjfaANgQu7BOWNOm6acOQLeC-fHqcCOmjPkD2WGjz1I\">Google Doc<\/a><\/p>\n<p>\u5148\u6284\u5f55\u4e00\u6bb5\u7b80\u4ecb:<\/p>\n<blockquote><p>HttpClient\u7b80\u4ecb<br \/>\nHTTP \u534f\u8bae\u53ef\u80fd\u662f\u73b0\u5728 Internet \u4e0a\u4f7f\u7528\u5f97\u6700\u591a\u3001\u6700\u91cd\u8981\u7684\u534f\u8bae\u4e86\uff0c\u8d8a\u6765\u8d8a\u591a\u7684 Java \u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u76f4\u63a5\u901a\u8fc7 HTTP \u534f\u8bae\u6765\u8bbf\u95ee\u7f51\u7edc\u8d44\u6e90\u3002\u867d\u7136\u5728 JDK \u7684 java.net \u5305\u4e2d\u5df2\u7ecf\u63d0\u4f9b\u4e86\u8bbf\u95ee HTTP \u534f\u8bae\u7684\u57fa\u672c\u529f\u80fd\uff0c\u4f46\u662f\u5bf9\u4e8e\u5927\u90e8\u5206\u5e94\u7528\u7a0b\u5e8f\u6765\u8bf4\uff0cJDK \u5e93\u672c\u8eab\u63d0\u4f9b\u7684\u529f\u80fd\u8fd8\u4e0d\u591f\u4e30\u5bcc\u548c\u7075\u6d3b\u3002HttpClient \u662f Apache Jakarta Common \u4e0b\u7684\u5b50\u9879\u76ee\uff0c\u7528\u6765\u63d0\u4f9b\u9ad8\u6548\u7684\u3001\u6700\u65b0\u7684\u3001\u529f\u80fd\u4e30\u5bcc\u7684\u652f\u6301 HTTP \u534f\u8bae\u7684\u5ba2\u6237\u7aef\u7f16\u7a0b\u5de5\u5177\u5305\uff0c\u5e76\u4e14\u5b83\u652f\u6301 HTTP \u534f\u8bae\u6700\u65b0\u7684\u7248\u672c\u548c\u5efa\u8bae\u3002<\/p><\/blockquote>\n<p>\u7f51\u4e0a\u6709\u5927\u91cf\u5173\u4e8eHttpClient\u7684\u4fe1\u606f,\u8fd9\u91cc\u5c31\u4e0d\u505a\u4ecb\u7ecd\u4e86.<\/p>\n<p>\u56de\u5230\u672c\u6587\u91cd\u70b9,<br \/>\n<strong>1.\u5982\u4f55\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185\u7f51?<\/strong><br \/>\n<!--more--><br \/>\n\u7531\u4e8e\u6211\u4eec\u8981\u5229\u7528HttpClient\u7684\u7279\u6027\u6a21\u4effBrowser\u7684\u767b\u5f55\u6d41\u7a0b,\u90a3\u81ea\u7136\u7b2c\u4e00\u6b65\u5c31\u662f\u8981\u5f97\u5230Browser\u767b\u5f55\u6821\u5185\u7684\u5177\u4f53\u6d41\u7a0b\u4e86.<br \/>\n\u8fd9\u4e2a\u6d41\u7a0b\u8981\u600e\u4e48\u5f97\u5230\u5462?\u8fd9\u5c31\u8981\u611f\u8c22\u5f3a\u5927\u7684wireshark\u5206\u6790\u529f\u80fd\u4e86,\u5229\u7528\u5b83\u53ef\u4ee5\u5f88\u8f7b\u677e\u7684\u6293\u53d6\u767b\u5f55\u65f6\u7684\u7f51\u7edc\u6570\u636e\u5305.\u5982\u4f55\u4f7f\u7528wireshark,\u4e0d\u662f\u672c\u6587\u91cd\u70b9,\u7f51\u4e0a\u6709\u5927\u91cf\u6559\u7a0b,\u8fd9\u91cc\u7b80\u5355\u8bf4\u4e0b:Capture->Option->Capture Filter:\u586b\u5165host  youripaddress(\u8fd9\u662f\u6700\u7b80\u5355\u7684,\u4f1a\u6293\u53d6\u6240\u6709\u7684\u6570\u636e\u5305)\u7136\u540estart\u5c31\u53ef\u4ee5\u4e86.\u6293\u53d6\u5b8c\u4e86\u4e4b\u540e,\u9009\u4e2d\u67d0\u4e00\u6761\u8bb0\u5f55\u53f3\u952e->Follow Tcp Stream,\u5c31\u53ef\u4ee5\u770b\u5230\u8fd9\u6b21\u7f51\u7edc\u6570\u636e\u5305\u7684\u5177\u4f53\u4fe1\u606f\u4e86.<\/p>\n<p>\u4e0b\u56fe\u662f\u6211\u6293\u5230\u7684\u6821\u5185\u767b\u5f55\u8fc7\u7a0b:<br \/>\n<a href=\"http:\/\/www.flickr.com\/photos\/pengjianqing\/4979158780\/\" title=\"Flickr \u4e0a pengjianqing \u7684 BrowserLoginXiaonei\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/farm5.static.flickr.com\/4133\/4979158780_7a79af72d6.jpg\" width=\"500\" height=\"240\" alt=\"BrowserLoginXiaonei\" \/><\/a><\/p>\n<p>Login\u53ea\u662f\u4e00\u4e2aPOST\u6570\u636e\u7684\u8fc7\u7a0b,POST\u7684\u6570\u636e\u5305\u542b<\/p>\n<pre>email,password,originURL,domain<\/pre>\n<p>\u8fd9\u56db\u4e2a\u53c2\u6570,\u90a3\u6211\u4eec\u53ea\u8981\u5728\u5229\u7528HttpClient POST\u6570\u636e\u65f6,\u4f9d\u7167\u8fd9\u4e2a\u6837\u5b50\u628a\u53c2\u6570\u8bbe\u7f6e\u8fdb\u53bb\u5c31\u884c\u4e86:<\/p>\n<pre lang=\"java\" line=\"1\">\nHttpPost httpPost = new HttpPost(loginUri);\n       List<nameValuePair> nvp = new ArrayList<nameValuePair>();\n       nvp.add(new BasicNameValuePair(\"email\", username));\n       nvp.add(new BasicNameValuePair(\"password\", password));\n       nvp.add(new BasicNameValuePair(\"originUrl\", originUrl));\n       nvp.add(new BasicNameValuePair(\"domain\", domain));\n       httpPost.setEntity(new UrlEncodedFormEntity(nvp, HTTP.UTF_8));\n<\/pre>\n<p>\u7136\u540e\u7528httpClient.execute\u6267\u884c\u8fd9\u6b21Post:<\/p>\n<pre>\n           HttpResponse response = httpClient.execute(httpPost);<\/pre>\n<p>\u8fd9\u6837\u5c31\u5b8c\u6210\u4e86\u4e00\u6b21\u5b8c\u6574\u7684Login\u8fc7\u7a0b,\u4e4b\u540e\u53ef\u4ee5\u6839\u636eresponse\u5b9e\u636e\u60c5\u51b5\u518d\u505a\u5904\u7406:<br \/>\n\u5728\u8fd9\u91cc\u5b83\u8fd4\u56de\u4e86302 Found,\u8868\u793a\u8981\u518d\u6b21\u6253\u5f00\u53e6\u5916\u4e00\u4e2a\u9875\u9762,\u4e5f\u5c31\u662f\u4e0a\u56feHeader \u4e2dLocation\u5bf9\u5e94\u7684\u503c(Uri).<br \/>\n\u4e4b\u540e\u6211\u4eec\u53ef\u4ee5\u518d\u5229\u7528HttpGet\u83b7\u53d6\u8fd9\u4e2aUri\u4e2d\u7684\u5185\u5bb9,\u91cc\u9762\u5e94\u8be5\u5c31\u662f\u4f60\u767b\u5f55\u540e,\u770b\u5230\u7684\u5185\u5bb9,\u53ea\u662f\u6211\u4eec\u5f97\u5230\u7684\u662fHtml\u6e90\u7801\u6587\u4ef6.<\/p>\n<p>\u81f3\u6b64\u6211\u4eec\u5df2\u7ecf\u5b8c\u6210\u4e86\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185\u7684\u8fc7\u7a0b,\u63a5\u4e0b\u6765\u4f60\u662f\u4e0d\u662f\u4f1a\u60f3,\u65e2\u7136\u5df2\u7ecf\u767b\u5f55\u4e86,\u90a3\u662f\u4e0d\u662f\u53ef\u4ee5\u7ee7\u7eed\u505a\u4e00\u4e9b\u4e8b\u60c5\u5462?\u6bd4\u5982\u8bf4\u66f4\u65b0\u4e00\u4e2a\u72b6\u6001.<br \/>\n<strong>2.\u5982\u4f55\u66f4\u65b0\u72b6\u6001<\/strong><\/p>\n<p>\u65e2\u7136\u60f3\u5230\u4e86\u8fd9\u91cc,\u8fd8\u662f\u8001\u529e\u6cd5,\u5229\u7528wireshark\u6293\u53d6Browser\u66f4\u65b0\u72b6\u6001\u7684\u6570\u636e\u5305.<br \/>\n\u4e0b\u56fe\u662f\u6211\u6293\u5230\u7684\u4e00\u4e2a\u6570\u636e\u5305,\u66f4\u65b0\u72b6\u6001\u5185\u5bb9\u4e3a:testabcdefg<br \/>\n<a href=\"http:\/\/www.flickr.com\/photos\/pengjianqing\/4979158784\/\" title=\"Flickr \u4e0a pengjianqing \u7684 BrowserPostToXiaonei\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/farm5.static.flickr.com\/4107\/4979158784_c2770dae32.jpg\" width=\"500\" height=\"263\" alt=\"BrowserPostToXiaonei\" \/><\/a><\/p>\n<p>\u8fd9\u91cc\u9762\u5171\u5e26\u4e864\u4e2a\u53c2\u6570:<\/p>\n<pre>c,raw,publisher_form_ticket,requestToken<\/pre>\n<p>\u5176\u4e2dc=raw,publisher_form_ticket=requestToken,\u8fd9\u4e24\u4e2a\u503c\u4e3a\u4ec0\u4e48\u4f1a\u76f8\u7b49,\u8fd9\u4e2a\u6211\u5c31\u4e0d\u5f97\u800c\u77e5\u4e86.<br \/>\n\u8fd9\u5176\u4e2d\u7684ticket\u662f\u4ec0\u4e48\u53c2\u6570\u5462,\u4ece\u54ea\u4e2a\u5730\u65b9\u53ef\u4ee5\u5f97\u5230\u5462?<br \/>\n\u4f60\u5bf9\u4f60\u7684Browser\u70b9\u53f3\u952e,\u67e5\u770b\u7f51\u9875\u6e90\u4ee3\u7801,\u628a\u6293\u5230\u7684\u8fd9\u4e2aticket\u5728\u4e0a\u9762\u641c\u7d22\u4e0b\u5c31\u53ef\u4ee5\u627e\u5230\u4e86,\u65e2\u7136\u5728\u7f51\u9875\u6e90\u7801\u91cc\u9762\u53ef\u4ee5\u627e\u5230,\u90a3\u6211\u4eec\u81ea\u7136\u662f\u5148\u8981\u6293\u53d6\u8fd9\u4e2a\u7f51\u9875\u6e90\u7801\u5f97\u5230ticket\u624d\u540e\u8fdb\u884c\u4e0b\u4e00\u6b65\u64cd\u4f5c.<br \/>\n\u9700\u8981\u6293\u53d6\u7684\u7f51\u9875\u6e90\u7801\u5c31\u662f\u5728Login\u65f6\u770b\u5230\u7684Location\u540e\u9762\u7684uri,\u628a\u8fd9\u4e2auri\u5185\u5bb9\u6293\u4e0b\u6765,\u7136\u540e\u518d\u627e\u5230ticket\u5c31\u597d\u4e86.<\/p>\n<pre lang=\"java\" line=\"1\">\n    HttpGet httpGet = new HttpGet(uri);\n\n           try {\n               HttpResponse response = httpClient.execute(httpGet);\n               Log.e(tag, \"\" + response.getStatusLine());\n               HttpEntity httpEntity = response.getEntity();\n\n               if (null != httpEntity) {\n                   String entity = EntityUtils.toString(httpEntity);\n\n                   ticket = getTicket(entity);\n                   Log.e(tag, \"ticket=\" + ticket);\n                   \/\/ Log.e(tag, entity);\n                   httpEntity.consumeContent();\n               }\n<\/pre>\n<p>\u5176\u4e2dgetTicket\u5b9e\u73b0\u4e3a,\u8fd9\u4e2a\u65b9\u6cd5\u4e0d\u4fdd\u8bc1\u957f\u671f\u6709\u6548,\u53ea\u80fd\u8bf4\u76ee\u524d\u6709\u6548,\u8bf4\u4e0d\u5b9a\u4ec0\u4e48\u65f6\u5019\u6821\u5185\u53c8\u66f4\u65b0\u7684\u7f51\u9875.<\/p>\n<pre lang=\"java\" line=\"1\">\npublic static String getTicket(String str) {\n       str = str.split(\"publisher_form_ticket\\\" value=\\\"\")[1];\n       return str.split(\"\\\"\")[0];\n   }\n\n<\/pre>\n<p>\u5f97\u5230ticket\u4e4b\u540e,\u5c31\u53ef\u4ee5\u6a21\u62dfPOST\u7684\u8fc7\u7a0b\u4e86;<\/p>\n<pre lang=\"java\" line=\"1\">\nHttpPost httpPost = new HttpPost(postStatusUrl);\n\n       List<nameValuePair> nvp = new ArrayList<nameValuePair>();\n       nvp.add(new BasicNameValuePair(\"c\", status));\n       nvp.add(new BasicNameValuePair(\"raw\", status));\n       String requestToken = ticket;\n       nvp.add(new BasicNameValuePair(\"publisher_form_ticket\", ticket));\n       nvp.add(new BasicNameValuePair(\"requestToken\", requestToken));\n\n       try {\n           httpPost.setEntity(new UrlEncodedFormEntity(nvp, HTTP.UTF_8));\n           HttpResponse httpResponse = httpClient.execute(httpPost);\n<\/pre>\n<p>\u53ef\u4ee5\u5c06\u5b83\u7684\u7ed3\u679c\u90fd\u6253\u5370\u51fa\u6765\u770b\u770b:<\/p>\n<pre lang=\"java\" line=\"1\">\nLog.e(tag, \"post status finished:\" + httpResponse.getStatusLine());\n\n           HttpEntity httpEntity = httpResponse.getEntity();\n\n           if (null != httpEntity) {\n               Log.e(tag, EntityUtils.toString(httpEntity));\n           }\n\n<\/pre>\n<p>\u5982\u679c\u80fd\u770b\u5230\u7c7b\u4f3c\u4e8e\u4e0b\u9762\u8fd9\u6837\u7684\u4fe1\u606f\u5c31\u8868\u793a\u6210\u529f\u4e86:<\/p>\n<pre>\n{\"allMsg\":\"test1234\",\"updateStatusId\":1.397876723e9,\"dtime\":\"Sat Sep 11 15:14:57 CST 2010\",\"code\":0,\"msg\":\"test1234\"}\n<\/pre>\n<p>\u81f3\u6b64\u6211\u4eec\u5df2\u7ecf\u5b9e\u73b0\u4e86\u66f4\u65b0\u72b6\u6001\u7684\u529f\u80fd,\u6211\u60f3\u5176\u5b83\u7684\u529f\u80fd\u4e5f\u7c7b\u4f3c\u4e8e\u8fd9\u6837\u5c31\u53ef\u4ee5\u5b9e\u73b0\u4e86,\u8fd9\u65f6\u5c31\u4e0d\u505a\u6df1\u7a76\u4e86.<\/p>\n<p>\u6211\u5df2\u7ecf\u5c06\u8fd9\u4e9b\u6d4b\u8bd5 \u6e90\u4ee3\u7801\u653e\u5230github\u4e0a\u4e86:<br \/>\n<a href=\"http:\/\/github.com\/PercyPeng\/sns\/tree\/\">http:\/\/github.com\/PercyPeng\/sns\/tree\/<\/a><br \/>\n\u9700\u8981\u7684\u81ea\u5df1clone,\u76f4\u63a5\u5bfc\u5165\u5230eclipse\u5c31\u53ef\u4ee5\u4e86.<br \/>\nmain\u51fd\u6570\u5165\u53e3\u5728SNS.java.<\/p>\n<\/ul>\n<ul>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185 Google Doc \u5148\u6284\u5f55\u4e00\u6bb5\u7b80\u4ecb: HttpClient\u7b80\u4ecb HTTP \u534f\u8bae\u53ef\u80fd\u662f\u73b0\u5728 Internet \u4e0a\u4f7f\u7528\u5f97\u6700\u591a\u3001\u6700\u91cd\u8981\u7684\u534f\u8bae\u4e86\uff0c\u8d8a\u6765\u8d8a\u591a\u7684 Java \u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u76f4\u63a5\u901a\u8fc7 HTTP \u534f\u8bae\u6765\u8bbf\u95ee\u7f51\u7edc\u8d44\u6e90\u3002\u867d\u7136\u5728 JDK \u7684 java.net \u5305\u4e2d\u5df2\u7ecf\u63d0\u4f9b\u4e86\u8bbf\u95ee HTTP \u534f\u8bae\u7684\u57fa\u672c\u529f\u80fd\uff0c\u4f46\u662f\u5bf9\u4e8e\u5927\u90e8\u5206\u5e94\u7528\u7a0b\u5e8f\u6765\u8bf4\uff0cJDK \u5e93\u672c\u8eab\u63d0\u4f9b\u7684\u529f\u80fd\u8fd8\u4e0d\u591f\u4e30\u5bcc\u548c\u7075\u6d3b\u3002HttpClient \u662f Apache Jakarta Common \u4e0b\u7684\u5b50\u9879\u76ee\uff0c\u7528\u6765\u63d0\u4f9b\u9ad8\u6548\u7684\u3001\u6700\u65b0\u7684\u3001\u529f\u80fd\u4e30\u5bcc\u7684\u652f\u6301 HTTP \u534f\u8bae\u7684\u5ba2\u6237\u7aef\u7f16\u7a0b\u5de5\u5177\u5305\uff0c\u5e76\u4e14\u5b83\u652f\u6301 HTTP \u534f\u8bae\u6700\u65b0\u7684\u7248\u672c\u548c\u5efa\u8bae\u3002 \u7f51\u4e0a\u6709\u5927\u91cf\u5173\u4e8eHttpClient\u7684\u4fe1\u606f,\u8fd9\u91cc\u5c31\u4e0d\u505a\u4ecb\u7ecd\u4e86. \u56de\u5230\u672c\u6587\u91cd\u70b9, 1.\u5982\u4f55\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185\u7f51?<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34],"tags":[71,79,83,123],"class_list":["post-876","post","type-post","status-publish","format-standard","hentry","category-java","tag-github","tag-httpclient","tag-java","tag-xiaonei"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185 - Jianqing&#039;s Blog<\/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:\/\/pjq.me\/?p=876\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185 - Jianqing&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185 Google Doc \u5148\u6284\u5f55\u4e00\u6bb5\u7b80\u4ecb: HttpClient\u7b80\u4ecb HTTP \u534f\u8bae\u53ef\u80fd\u662f\u73b0\u5728 Internet \u4e0a\u4f7f\u7528\u5f97\u6700\u591a\u3001\u6700\u91cd\u8981\u7684\u534f\u8bae\u4e86\uff0c\u8d8a\u6765\u8d8a\u591a\u7684 Java \u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u76f4\u63a5\u901a\u8fc7 HTTP \u534f\u8bae\u6765\u8bbf\u95ee\u7f51\u7edc\u8d44\u6e90\u3002\u867d\u7136\u5728 JDK \u7684 java.net \u5305\u4e2d\u5df2\u7ecf\u63d0\u4f9b\u4e86\u8bbf\u95ee HTTP \u534f\u8bae\u7684\u57fa\u672c\u529f\u80fd\uff0c\u4f46\u662f\u5bf9\u4e8e\u5927\u90e8\u5206\u5e94\u7528\u7a0b\u5e8f\u6765\u8bf4\uff0cJDK \u5e93\u672c\u8eab\u63d0\u4f9b\u7684\u529f\u80fd\u8fd8\u4e0d\u591f\u4e30\u5bcc\u548c\u7075\u6d3b\u3002HttpClient \u662f Apache Jakarta Common \u4e0b\u7684\u5b50\u9879\u76ee\uff0c\u7528\u6765\u63d0\u4f9b\u9ad8\u6548\u7684\u3001\u6700\u65b0\u7684\u3001\u529f\u80fd\u4e30\u5bcc\u7684\u652f\u6301 HTTP \u534f\u8bae\u7684\u5ba2\u6237\u7aef\u7f16\u7a0b\u5de5\u5177\u5305\uff0c\u5e76\u4e14\u5b83\u652f\u6301 HTTP \u534f\u8bae\u6700\u65b0\u7684\u7248\u672c\u548c\u5efa\u8bae\u3002 \u7f51\u4e0a\u6709\u5927\u91cf\u5173\u4e8eHttpClient\u7684\u4fe1\u606f,\u8fd9\u91cc\u5c31\u4e0d\u505a\u4ecb\u7ecd\u4e86. \u56de\u5230\u672c\u6587\u91cd\u70b9, 1.\u5982\u4f55\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185\u7f51?\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pjq.me\/?p=876\" \/>\n<meta property=\"og:site_name\" content=\"Jianqing&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2010-09-11T08:36:31+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/farm5.static.flickr.com\/4133\/4979158780_7a79af72d6.jpg\" \/>\n<meta name=\"author\" content=\"pengjianqing\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pengjianqing\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/pjq.me\/?p=876#article\",\"isPartOf\":{\"@id\":\"https:\/\/pjq.me\/?p=876\"},\"author\":{\"name\":\"pengjianqing\",\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\"},\"headline\":\"\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185\",\"datePublished\":\"2010-09-11T08:36:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/pjq.me\/?p=876\"},\"wordCount\":89,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\"},\"image\":{\"@id\":\"https:\/\/pjq.me\/?p=876#primaryimage\"},\"thumbnailUrl\":\"http:\/\/farm5.static.flickr.com\/4133\/4979158780_7a79af72d6.jpg\",\"keywords\":[\"github\",\"HttpClient\",\"Java\",\"Xiaonei\"],\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/pjq.me\/?p=876#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/pjq.me\/?p=876\",\"url\":\"https:\/\/pjq.me\/?p=876\",\"name\":\"\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185 - Jianqing&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/pjq.me\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/pjq.me\/?p=876#primaryimage\"},\"image\":{\"@id\":\"https:\/\/pjq.me\/?p=876#primaryimage\"},\"thumbnailUrl\":\"http:\/\/farm5.static.flickr.com\/4133\/4979158780_7a79af72d6.jpg\",\"datePublished\":\"2010-09-11T08:36:31+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/pjq.me\/?p=876#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/pjq.me\/?p=876\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pjq.me\/?p=876#primaryimage\",\"url\":\"http:\/\/farm5.static.flickr.com\/4133\/4979158780_7a79af72d6.jpg\",\"contentUrl\":\"http:\/\/farm5.static.flickr.com\/4133\/4979158780_7a79af72d6.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/pjq.me\/?p=876#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/pjq.me\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/pjq.me\/#website\",\"url\":\"https:\/\/pjq.me\/\",\"name\":\"Jianqing&#039;s Blog\",\"description\":\"Thoughts and Future\",\"publisher\":{\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/pjq.me\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60\",\"name\":\"pengjianqing\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png\",\"contentUrl\":\"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png\",\"width\":460,\"height\":752,\"caption\":\"pengjianqing\"},\"logo\":{\"@id\":\"https:\/\/pjq.me\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/pjq.me\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185 - Jianqing&#039;s Blog","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:\/\/pjq.me\/?p=876","og_locale":"en_US","og_type":"article","og_title":"\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185 - Jianqing&#039;s Blog","og_description":"\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185 Google Doc \u5148\u6284\u5f55\u4e00\u6bb5\u7b80\u4ecb: HttpClient\u7b80\u4ecb HTTP \u534f\u8bae\u53ef\u80fd\u662f\u73b0\u5728 Internet \u4e0a\u4f7f\u7528\u5f97\u6700\u591a\u3001\u6700\u91cd\u8981\u7684\u534f\u8bae\u4e86\uff0c\u8d8a\u6765\u8d8a\u591a\u7684 Java \u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u76f4\u63a5\u901a\u8fc7 HTTP \u534f\u8bae\u6765\u8bbf\u95ee\u7f51\u7edc\u8d44\u6e90\u3002\u867d\u7136\u5728 JDK \u7684 java.net \u5305\u4e2d\u5df2\u7ecf\u63d0\u4f9b\u4e86\u8bbf\u95ee HTTP \u534f\u8bae\u7684\u57fa\u672c\u529f\u80fd\uff0c\u4f46\u662f\u5bf9\u4e8e\u5927\u90e8\u5206\u5e94\u7528\u7a0b\u5e8f\u6765\u8bf4\uff0cJDK \u5e93\u672c\u8eab\u63d0\u4f9b\u7684\u529f\u80fd\u8fd8\u4e0d\u591f\u4e30\u5bcc\u548c\u7075\u6d3b\u3002HttpClient \u662f Apache Jakarta Common \u4e0b\u7684\u5b50\u9879\u76ee\uff0c\u7528\u6765\u63d0\u4f9b\u9ad8\u6548\u7684\u3001\u6700\u65b0\u7684\u3001\u529f\u80fd\u4e30\u5bcc\u7684\u652f\u6301 HTTP \u534f\u8bae\u7684\u5ba2\u6237\u7aef\u7f16\u7a0b\u5de5\u5177\u5305\uff0c\u5e76\u4e14\u5b83\u652f\u6301 HTTP \u534f\u8bae\u6700\u65b0\u7684\u7248\u672c\u548c\u5efa\u8bae\u3002 \u7f51\u4e0a\u6709\u5927\u91cf\u5173\u4e8eHttpClient\u7684\u4fe1\u606f,\u8fd9\u91cc\u5c31\u4e0d\u505a\u4ecb\u7ecd\u4e86. \u56de\u5230\u672c\u6587\u91cd\u70b9, 1.\u5982\u4f55\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185\u7f51?","og_url":"https:\/\/pjq.me\/?p=876","og_site_name":"Jianqing&#039;s Blog","article_published_time":"2010-09-11T08:36:31+00:00","og_image":[{"url":"http:\/\/farm5.static.flickr.com\/4133\/4979158780_7a79af72d6.jpg","type":"","width":"","height":""}],"author":"pengjianqing","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pengjianqing","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/pjq.me\/?p=876#article","isPartOf":{"@id":"https:\/\/pjq.me\/?p=876"},"author":{"name":"pengjianqing","@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60"},"headline":"\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185","datePublished":"2010-09-11T08:36:31+00:00","mainEntityOfPage":{"@id":"https:\/\/pjq.me\/?p=876"},"wordCount":89,"commentCount":1,"publisher":{"@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60"},"image":{"@id":"https:\/\/pjq.me\/?p=876#primaryimage"},"thumbnailUrl":"http:\/\/farm5.static.flickr.com\/4133\/4979158780_7a79af72d6.jpg","keywords":["github","HttpClient","Java","Xiaonei"],"articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/pjq.me\/?p=876#respond"]}]},{"@type":"WebPage","@id":"https:\/\/pjq.me\/?p=876","url":"https:\/\/pjq.me\/?p=876","name":"\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185 - Jianqing&#039;s Blog","isPartOf":{"@id":"https:\/\/pjq.me\/#website"},"primaryImageOfPage":{"@id":"https:\/\/pjq.me\/?p=876#primaryimage"},"image":{"@id":"https:\/\/pjq.me\/?p=876#primaryimage"},"thumbnailUrl":"http:\/\/farm5.static.flickr.com\/4133\/4979158780_7a79af72d6.jpg","datePublished":"2010-09-11T08:36:31+00:00","breadcrumb":{"@id":"https:\/\/pjq.me\/?p=876#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/pjq.me\/?p=876"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pjq.me\/?p=876#primaryimage","url":"http:\/\/farm5.static.flickr.com\/4133\/4979158780_7a79af72d6.jpg","contentUrl":"http:\/\/farm5.static.flickr.com\/4133\/4979158780_7a79af72d6.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/pjq.me\/?p=876#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/pjq.me\/"},{"@type":"ListItem","position":2,"name":"\u5229\u7528HttpClient\u767b\u5f55\u6821\u5185"}]},{"@type":"WebSite","@id":"https:\/\/pjq.me\/#website","url":"https:\/\/pjq.me\/","name":"Jianqing&#039;s Blog","description":"Thoughts and Future","publisher":{"@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/pjq.me\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/pjq.me\/#\/schema\/person\/0eb1e72d1e69fbbd9b5c0bfd8e2aae60","name":"pengjianqing","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/pjq.me\/#\/schema\/person\/image\/","url":"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png","contentUrl":"https:\/\/pjq.me\/wp-content\/uploads\/2021\/12\/Screen-Shot-2021-12-02-at-6.10.58-PM.png","width":460,"height":752,"caption":"pengjianqing"},"logo":{"@id":"https:\/\/pjq.me\/#\/schema\/person\/image\/"},"url":"https:\/\/pjq.me\/?author=1"}]}},"views":30136,"_links":{"self":[{"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts\/876","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=876"}],"version-history":[{"count":0,"href":"https:\/\/pjq.me\/index.php?rest_route=\/wp\/v2\/posts\/876\/revisions"}],"wp:attachment":[{"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=876"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=876"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pjq.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=876"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}