{"id":484,"date":"2012-06-22T11:51:31","date_gmt":"2012-06-22T11:51:31","guid":{"rendered":"http:\/\/nangchang.nes.or.kr\/?p=484"},"modified":"2012-06-22T11:51:31","modified_gmt":"2012-06-22T11:51:31","slug":"android-%ec%97%90%ec%84%9c-restlet-net-extension-http-client-connector-%ec%82%ac%ec%9a%a9-%ec%8b%9c-timeout-%ec%84%a4%ec%a0%95","status":"publish","type":"post","link":"https:\/\/nangchang.nes.or.kr\/?p=484","title":{"rendered":"Android \uc5d0\uc11c Restlet Net extension HTTP client connector \uc0ac\uc6a9 \uc2dc timeout \uc124\uc815"},"content":{"rendered":"<p>&nbsp;\uacb0\ub860\ubd80\ud130 \ub9d0\ud558\uc790\uba74 \ub77c\uc774\ube0c\ub7ec\ub9ac \ubc84\uadf8\ub784\uae4c&#8230;<\/p>\n<p>\uc548\ub4dc\ub85c\uc774\ub4dc\uc5d0\uc11c\ub294 net extension\uc758 HTTP client connector\ub97c \uc0ac\uc6a9\ud558\uba74<br \/>connection timeout \uacfc read timeout\uc744 \uc124\uc815\ud574\ub3c4 \uc801\uc6a9\uc774 \uc548\ub41c\ub2e4.<\/p>\n<p>Resetlet \ubb38\uc11c\ub97c \ubcf4\uba74 Internal Connector\uc758 HTTP connector\ub294 <br \/>development only \ub97c \ucd94\ucc9c\ud55c\ub2e4\uace0 \ub2f9\ub2f9\ud788 \uc368 \uc788\uae30\ub3c4 \ud55c\ub370\ub2e4\uac00<br \/>\uc11c\ubc84 \ub2e4\uc6b4\uc73c\ub85c \uc811\uc18d\uc774 \uc548\ub420 \ub54c \uc790\uafb8 \ubb38\uc81c\ub97c \uc788\uc73c\ucf1c\uc11c Net extention\uc758 HTTP connector\ub97c \uc4f0\uae30\ub85c \ud588\ub2e4.<\/p>\n<p>\uc548\ub4dc\ub85c\uc774\ub4dc\uc5d0\uc11c\ub294 \uc790\ub3d9\uc73c\ub85c \uc4f8\uc218 \uc788\uac8c \ud558\ub294\uac8c \uc548\ub41c\ub2e4\ub294\uac70 \uac19\uace0.. \ub2e4\uc74c\uacfc \uac19\uc774 \ud574\uc918\uc57c \ud55c\ub2e4.<\/p>\n<blockquote><p><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t\t<\/span>final Engine engine = Engine.getInstance();<br \/><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t\t<\/span>engine.getRegisteredClients().clear();<br \/><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t\t<\/span>engine.getRegisteredClients().add(new HttpClientHelper(null));<\/p><\/blockquote>\n<p>\uadf8\ub9ac\uace0, read timeout \uacfc connection timeout\uc744 \uc124\uc815\ud558\uace0, ClientResource\uc5d0\uc11c <br \/>\ud574\ub2f9 client\ub97c \uc0ac\uc6a9\ud558\ub3c4\ub85d \uc124\uc815\ud574 \uc900\ub2e4.<\/p>\n<p><\/p>\n<blockquote><p><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t\t<\/span>final Context context = new Context();<\/p>\n<p><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t\t<\/span>final Series&lt;Parameter&gt; parameters = context.getParameters();<br \/><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t\t<\/span>parameters.add(&#8220;readTimeout&#8221;, Integer.toString(READ_TIMEOUT));<br \/><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t\t<\/span><br \/><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t\t<\/span>final Client client = new Client(context, Protocol.HTTP);<br \/><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t\t<\/span>client.setConnectTimeout(CONNECTION_TIMEOUT);<\/p>\n<p><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t\t<\/span>final ClientResource cr = new ClientResource(requestUrl);<br \/><span class=\"Apple-tab-span\" style=\"white-space: pre; \">\t\t<\/span>cr.setNext(client);<\/p><\/blockquote>\n<p>\uadf8\ub7f0\ub370, timeout\uc774 \uc804\ud600 \uc548\uba39\ub294\ub2e4=_=<br \/>\uc124\uc815\ud558\ub294 \ubc29\ubc95\uc774 \uc798\ubabb\ub410\ub098 \uc2f6\uc5b4 \uc628\uac16 \uc0bd\uc9c8\uc744 \ub3d9\uc6d0\ud558\uba70 \uc774\ub9ac\uc800\ub9ac \ud14c\uc2a4\ud2b8 \ud574\ub3c4 \ub2f5\uc774 \ub098\uc624\uc9c8 \uc54a\ub294\ub2e4..<br \/>\uadf8\ub798\uc11c, \uacb0\uad6d Restlet \uc18c\uc2a4\ub97c \ub4a4\uc9c0\uae30 \uc2dc\uc791\ud588\ub2e4.<br \/>(\ub77c\uc774\ube0c\ub7ec\ub9ac \uc18c\uc2a4\ub098 \ub4a4\uc9c0\ub294 \uc2e0\uc138\ub77c\ub2c8&#8230; OTL)<\/p>\n<p>\ub9c8\uce68\ub0b4 \ucc3e\uc544\ub0b8 \ubd80\ubd84\uc740&#8230; org\/restlet\/ext\/net\/internal\/HttpUrlConnectionCall.java \ud30c\uc77c\uc758<\/p>\n<blockquote><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ These properties can only be used with Java 1.5 and upper<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ releases<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int majorVersionNumber = SystemUtils.getJavaMajorVersion();<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int minorVersionNumber = SystemUtils.getJavaMinorVersion();<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ((majorVersionNumber &gt; 1)<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; || ((majorVersionNumber == 1) &amp;&amp; (minorVersionNumber &gt;= 5))) {<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.connection.setConnectTimeout(getHelper()<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .getConnectTimeout());<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.connection.setReadTimeout(getHelper().getReadTimeout());<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<\/p><\/blockquote>\n<p>JDK \ubc84\uc804\uc744 \uccb4\ud06c\ud574\uc11c 1.5 \uc774\uc0c1 \uc77c\ub54c\ub9cc timeout\uc744 \uc124\uc815\ud558\ub3c4\ub85d \ud558\ub294 \ubd80\ubd84\uc774\uc5c8\ub2e4.<br \/>\uba3c\uac00 \uc758\uc2ec\uc2a4\ub7ec\uc6cc\uc11c, \uc548\ub4dc\ub85c\uc774\ub4dc\uc5d0\uc11c \ubc84\uc804\uac12\uc744 \ucc0d\uc5b4 \ubd24\ub2e4.<br \/>&#8230; \ub458\ub2e4 0 \uc774 \ub098\uc628\ub2e4..=_=<br \/>\uc774\uac74 \ub0b4\uac00 \uc798\ubabb\ud55c\uac74\uc9c0 \uc7e4\ub4e4\uc774 \uc548\ub4dc\ub85c\uc774\ub4dc\uc6a9\uc774\ub77c\uba74\uc11c \uc548\ub4dc\ub85c\uc774\ub4dc \uace0\ub824\ub97c \ubabb\ud55c\uac74\uc9c0&#8230;<br \/>\ub3c4\uc800\ud788 \ud310\ub2e8\uc774 \uc548\uc11c\ub294 \uc0c1\ud669\uc774\uc9c0\ub9cc, \uad6c\uad6d\uc758 \uacb0\ub2e8\uc744 \ub0b4\ub824 \ub77c\uc774\ube0c\ub7ec\ub9ac \uc18c\uc2a4\ub97c \uc9c1\uc811 \ucef4\ud30c\uc77c\ud574 \uc4f0\uae30\ub85c \uacb0\uc815;;<\/p>\n<blockquote><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.connection.setConnectTimeout(getHelper()<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .getConnectTimeout());<br \/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.connection.setReadTimeout(getHelper().getReadTimeout());<\/p><\/blockquote>\n<p>\uc694\ub807\uac8c \uace0\uccd0\uc11c \ud574\uacb0\uc744 \ubd10\ubc84\ub838\ub2e4=_=<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;\uacb0\ub860\ubd80\ud130 \ub9d0\ud558\uc790\uba74 \ub77c\uc774\ube0c\ub7ec\ub9ac \ubc84\uadf8\ub784\uae4c&#8230; \uc548\ub4dc\ub85c\uc774\ub4dc\uc5d0\uc11c\ub294 net extension\uc758 HTTP client connector\ub97c \uc0ac\uc6a9\ud558\uba74connection timeout \uacfc read timeout\uc744 \uc124\uc815\ud574\ub3c4 \uc801\uc6a9\uc774 \uc548\ub41c\ub2e4. Resetlet \ubb38\uc11c\ub97c \ubcf4\uba74 Internal Connector\uc758 HTTP connector\ub294 development only \ub97c \ucd94\ucc9c\ud55c\ub2e4\uace0 \ub2f9\ub2f9\ud788 \uc368 \uc788\uae30\ub3c4 \ud55c\ub370\ub2e4\uac00\uc11c\ubc84 \ub2e4\uc6b4\uc73c\ub85c \uc811\uc18d\uc774 \uc548\ub420 \ub54c \uc790\uafb8 \ubb38\uc81c\ub97c \uc788\uc73c\ucf1c\uc11c Net extention\uc758 HTTP connector\ub97c \uc4f0\uae30\ub85c \ud588\ub2e4. \uc548\ub4dc\ub85c\uc774\ub4dc\uc5d0\uc11c\ub294 \uc790\ub3d9\uc73c\ub85c \uc4f8\uc218 \uc788\uac8c \ud558\ub294\uac8c \uc548\ub41c\ub2e4\ub294\uac70 \uac19\uace0.. \ub2e4\uc74c\uacfc \uac19\uc774 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[15,34],"class_list":["post-484","post","type-post","status-publish","format-standard","hentry","category-pogramming","tag-android","tag-restlet"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=\/wp\/v2\/posts\/484","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=484"}],"version-history":[{"count":0,"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=\/wp\/v2\/posts\/484\/revisions"}],"wp:attachment":[{"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nangchang.nes.or.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}