{"id":178403,"date":"2013-04-30T10:54:03","date_gmt":"2013-04-30T06:54:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=178403"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=178403","title":{"rendered":"<span class=\"post_title\">\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c Web API \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 C++ \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 POCO<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/6cb\/7ed\/1ab\/6cb7ed1ab07daabbdd8150f93d6e7044.jpg\" align=\"right\"\/>\u0412 \u0436\u0438\u0437\u043d\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0440\u0443\u0436\u0443 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c API \u2014 \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432, \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0442.\u0434. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439, \u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c API \u0432 \u0432\u0438\u0434\u0435 REST-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0433\u043d\u0430\u0442\u044c\u0441\u044f \u0437\u0430 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0435\u0439 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u0438 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b: HTTP-\u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u0435\u0433\u043a\u043e \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430, \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0438 \u043f\u043e \u0441\u0435\u0442\u0438, \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0435\u0434\u0440\u044b \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432. <br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043a \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043d\u0430 C++ \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u043d\u044c\u043a\u043e \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c Web API, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"http:\/\/pocoproject.org\/\">POCO<\/a>.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0417\u0430\u0434\u0430\u0447\u0430<\/h4>\n<p>  \u041f\u0443\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430:  <\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &lt;conio.h&gt;  int main(int argc, char** argv) { \tfor(;;) \t{ \t\tstd::cout &lt;&lt; &quot;Hello world!&quot; &lt;&lt; std::endl; \t\t_getch(); \t}  \treturn 0; } <\/code><\/pre>\n<p>  \u041c\u044b \u0445\u043e\u0442\u0438\u043c \u0434\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0432\u043d\u0435 \u043c\u0435\u043d\u044f\u0442\u044c \u0432\u044b\u0432\u043e\u0434\u0438\u043c\u044b\u0439 \u0442\u0435\u043a\u0441\u0442. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0438\u0434\u0430:  <\/p>\n<pre>http:\/\/host:port\/setText?text=NewText<\/pre>\n<h4>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c POCO<\/h4>\n<p>  <\/p>\n<ol>\n<li>\u0418\u0434\u0451\u043c <a href=\"http:\/\/pocoproject.org\/download\/index.html\">\u0432\u043e\u0442 \u0441\u044e\u0434\u0430<\/a> \u0438 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e Basic Edition for Windows (1.4.6p1 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438).<\/li>\n<li>\u0420\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u043c \u043a\u0443\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c.<\/li>\n<li>\u0418\u0434\u0451\u043c \u0442\u0443\u0434\u0430, \u043a\u0443\u0434\u0430 \u0440\u0430\u0437\u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0438 \u0432\u0438\u0434\u0438\u043c \u0442\u0430\u043c \u0431\u0430\u0442\u043d\u0438\u043a\u0438 \u0441 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 <b>build_vs90.cmd<\/b>, <b>build_vs100.cmd<\/b>, <b>build_vs110.cmd<\/b>. \u041e\u043d\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u044e\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 POCO \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0430\u0437\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 Visual Studio. \u041f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043d\u0443\u0436\u043d\u044b\u0439 (\u0441\u0442\u0443\u0434\u0438\u044f, \u0441\u0430\u043c\u043e-\u0441\u043e\u0431\u043e\u0439, \u043a \u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0443\u0436\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430). \u042f \u043b\u0438\u0447\u043d\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b POCO \u043f\u043e\u0434 VS2008, VS2010 \u0438 VS2012 \u2014 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u043d\u0438 \u0440\u0430\u0437\u0443.<\/li>\n<\/ol>\n<h4>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c POCO \u043a \u0441\u0432\u043e\u0435\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443<\/h4>\n<p>  <\/p>\n<ol>\n<li>\u0421\u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0432 \u043f\u0430\u043f\u043a\u0435 \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0430\u043f\u043a\u0443 POCO<\/li>\n<li>\u0412 \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0435 \u0441\u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0442\u0440\u0438 \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0438: include, lib, bin.<\/li>\n<li>\u0412 \u043f\u0430\u043f\u043a\u0443 include \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u0432\u0441\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b POCO (\u0438\u0437 \u043f\u0430\u043f\u043e\u043a %POCO%\\XML\\include, %POCO%\\Util\\include, %POCO%\\Net\\include \u0438 %POCO%\\Foundation\\include)<\/li>\n<li>\u0412 \u043f\u0430\u043f\u043a\u0443 lib \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 lib-\u0444\u0430\u0439\u043b\u044b \u0438\u0437 %POCO%\\lib. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043d\u0435\u0441\u0442\u0438 \u0438\u0445 \u043f\u043e \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0430\u043c Debug \u0438 Release.<\/li>\n<li>\u0412 \u043f\u0430\u043f\u043a\u0443 bin \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 dll-\u0444\u0430\u0439\u043b\u044b \u0438\u0437 %POCO%\\bin. \u0418\u0445 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043d\u0435\u0441\u0442\u0438 \u043f\u043e \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0430\u043c Debug \u0438 Release.<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 include \u0432 <b>Additional Include Directories<\/b>, \u0430 \u043f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 lib \u2014 \u0432 <b>Additional Library Directories<\/b> \u0441\u0432\u043e\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u0423\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <b>$(SolutionDir)<\/b> \u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0443\u0442\u0438.<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0444\u0430\u0439\u043b\u044b PocoFoundationd.lib, PocoNetd.lib, PocoUtild.lib \u0432 <b>Additional Dependencies<\/b> \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043b\u044f Debug-\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u0430 \u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u0438 \u0431\u0435\u0437 \u0431\u0443\u043a\u0432\u044b \u00abd\u00bb \u0432 \u043a\u043e\u043d\u0446\u0435 \u2014 \u0434\u043b\u044f Release-\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/li>\n<li>\u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435, \u0447\u0442\u043e dll-\u0444\u0430\u0439\u043b\u044b \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 bin \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0435\u043f\u043b\u043e\u0438\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0432\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c. \u041c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0445 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432 \u043f\u0430\u043f\u043a\u0438 Debug\\Release \u0438\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0448\u0430\u0433 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438, \u0433\u0434\u0435 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0442\u0443\u0434\u0430 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f.<\/li>\n<\/ol>\n<p>  \u0412 \u043a\u043e\u043d\u0446\u0435 \u0442\u043e\u043f\u0438\u043a\u0430 \u0435\u0441\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 GitHub \u2014 \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u043a \u0431\u0430\u0437\u0443.<\/p>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c POCO \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f Web API<\/h4>\n<p>  \u041a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0439. \u0412 \u0433\u043b\u0430\u0432\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0442 ServerApplication. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0432 \u0433\u043b\u0430\u0432\u043d\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u0432\u044b\u0432\u043e\u0434 \u043d\u0430\u0448\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439, \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u0435 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u0430\u0441\u0441\u0430 HTTPServer. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u0442\u044c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u043a\u0430\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u0432\u043e\u044e \u0444\u0430\u0431\u0440\u0438\u043a\u0443, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043e\u0442 HTTPRequestHandlerFactory. \u041d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 (\u043a\u043b\u0430\u0441\u0441\u0430, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0442 HTTPRequestHandler), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0440\u0430\u0437\u0431\u043e\u0440\u043e\u043c \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430, \u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0438 \u0432\u044b\u0434\u0430\u0447\u0435\u0439 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<p>  \u0412 \u043a\u043e\u0434\u0435 \u0432\u0441\u0451 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u0432 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0432\u044b\u0448\u0435.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">PocoHelloWorld.cpp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &quot;MyRequestHandler.h&quot;  int main(int argc, char** argv) { \tMyServerApp app; \treturn app.run(argc, argv); } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<div class=\"spoiler\"><b class=\"spoiler_title\">MyRequestHandler.h<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#pragma once  #include &lt;Poco\/Mutex.h&gt; #include &lt;Poco\/Util\/ServerApplication.h&gt;  using namespace Poco; using namespace Poco::Util; using namespace std;  class MyServerApp : public ServerApplication { public: \tstatic string getText(); \tstatic void setText(string newText);  protected: \tint main(const vector&lt;string&gt; &); \tstatic string text; \tstatic Mutex textLock; }; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<div class=\"spoiler\"><b class=\"spoiler_title\">MyRequestHandler.cpp<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &lt;conio.h&gt; #include &lt;string&gt;  #include &quot;MyRequestHandler.h&quot; #include &lt;Poco\/Net\/HTTPServerRequest.h&gt; #include &lt;Poco\/Net\/HTTPRequestHandler.h&gt; #include &lt;Poco\/Net\/HTTPServerResponse.h&gt; #include &lt;Poco\/Net\/HTTPServer.h&gt; #include &lt;Poco\/Net\/HTTPRequestHandlerFactory.h&gt; #include &lt;Poco\/ScopedLock.h&gt; #include &lt;Poco\/URI.h&gt; #include &lt;Poco\/StringTokenizer.h&gt;  using namespace Poco::Net;  string MyServerApp::text = &quot;Hello world!&quot;; Mutex MyServerApp::textLock;  class CMyRequestHandler : public HTTPRequestHandler { public: \tvoid handleRequest(HTTPServerRequest &req, HTTPServerResponse &resp) \t{ \t\tresp.setStatus(HTTPResponse::HTTP_OK); \t\tresp.setContentType(&quot;text\/html&quot;); \t\tostream& out = resp.send();  \t\tURI uri(req.getURI()); \t\tif (uri.toString().find(&quot;\/setText&quot;) == 0) \t\t{ \t\t\tStringTokenizer str(uri.getQuery(), &quot;=&quot;); \t\t\tif (str.count() == 2 && str[0] == &quot;text&quot;) \t\t\t{ \t\t\t\tMyServerApp::setText(str[1]); \t\t\t\tout &lt;&lt; &quot;ok&quot;; \t\t\t\tout.flush(); \t\t\t\treturn; \t\t\t} \t\t}  \t\tout &lt;&lt; &quot;error&quot;; \t\tout.flush(); \t} };  class MyRequestHandlerFactory : public HTTPRequestHandlerFactory { public: \tvirtual HTTPRequestHandler* createRequestHandler(const HTTPServerRequest &) \t{ \t\treturn new CMyRequestHandler; \t} };  void MyServerApp::setText(string newText) { \tScopedLock&lt;Mutex&gt; lock(textLock); \ttext = newText; }  string MyServerApp::getText()  {  \tScopedLock&lt;Mutex&gt; lock(textLock); \treturn text;  }  int MyServerApp::main(const vector&lt;string&gt; &) { \tHTTPServer s(new MyRequestHandlerFactory, ServerSocket(8000), new HTTPServerParams); \ts.start(); \tfor(;;) \t{ \t\tcout &lt;&lt; MyServerApp::getText() &lt;&lt; endl; \t\t_getch(); \t} \ts.stop(); \treturn Application::EXIT_OK; } <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<h4>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b<\/h4>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/ezhikus\/PocoHelloWorld\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 GitHub<\/a><\/li>\n<li><a href=\"http:\/\/pocoproject.org\">\u0421\u0430\u0439\u0442 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 POCO<\/a><\/li>\n<li><a href=\"http:\/\/habrahabr.ru\/post\/148173\/\">\u0425\u043e\u0440\u043e\u0448\u0430\u044f \u043e\u0431\u0437\u043e\u0440\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043e POCO \u043d\u0430 \u0425\u0430\u0431\u0440\u0435<\/a><\/li>\n<\/ul>\n<p>  \u0412\u0441\u0435\u043c \u0441\u043f\u0430\u0441\u0438\u0431\u043e, \u0443\u0434\u0430\u0447\u0438 \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 POCO.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/178403\/\"> http:\/\/habrahabr.ru\/post\/178403\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/6cb\/7ed\/1ab\/6cb7ed1ab07daabbdd8150f93d6e7044.jpg\" align=\"right\"\/>\u0412 \u0436\u0438\u0437\u043d\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u043d\u0430\u0440\u0443\u0436\u0443 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c API \u2014 \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432, \u0434\u043b\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0442.\u0434. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439, \u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c API \u0432 \u0432\u0438\u0434\u0435 REST-\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0433\u043d\u0430\u0442\u044c\u0441\u044f \u0437\u0430 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0435\u0439 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u0438 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b: HTTP-\u0437\u0430\u043f\u0440\u043e\u0441 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u0435\u0433\u043a\u043e \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430, \u044d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0438 \u043f\u043e \u0441\u0435\u0442\u0438, \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u0438\u043b\u044c\u043d\u043e \u0433\u043b\u0443\u0431\u043e\u043a\u043e \u043f\u043e\u0433\u0440\u0443\u0436\u0430\u0442\u044c\u0441\u044f \u0432 \u043d\u0435\u0434\u0440\u044b \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u0432. <br \/>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u043a \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043d\u0430 C++ \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u043d\u044c\u043a\u043e \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c Web API, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"http:\/\/pocoproject.org\/\">POCO<\/a>.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-178403","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/178403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=178403"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/178403\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=178403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=178403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=178403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}