|
12 | 12 |
|
13 | 13 | #include<boost/network/protocol/http/response.hpp> |
14 | 14 | #include<boost/network/protocol/http/request.hpp> |
15 | | -#include<boost/network/protocol/http/server/sync_server.hpp> |
16 | 15 | #include<boost/network/protocol/http/server/async_server.hpp> |
17 | 16 |
|
18 | 17 | namespaceboost { |
19 | 18 | namespacenetwork { |
20 | 19 | namespacehttp { |
21 | 20 |
|
22 | | -template<classTag,classHandler,classEnable =void> |
23 | | -structserver_base { |
24 | | -typedef unsupported_tag<Tag> type; |
25 | | -}; |
26 | | - |
27 | | -template<classTag,classHandler> |
28 | | -structserver_base<Tag, Handler,typename enable_if<is_async<Tag> >::type> { |
29 | | -typedef async_server_base<Tag, Handler> type; |
30 | | -}; |
31 | | - |
32 | | -template<classTag,classHandler> |
33 | | -structserver_base<Tag, Handler,typename enable_if<is_sync<Tag> >::type> { |
34 | | -typedef sync_server_base<Tag, Handler> type; |
35 | | -}; |
36 | | - |
37 | | -template<classTag,classHandler> |
38 | | -structbasic_server : server_base<Tag, Handler>::type {}; |
39 | | - |
| 21 | +/** |
| 22 | + * The main HTTP Server template implementing an asynchronous HTTP service. |
| 23 | + * |
| 24 | + * Usage Example: |
| 25 | + * \code{.cpp} |
| 26 | + * handler_type handler; |
| 27 | + * http_server::options options(handler); |
| 28 | + * options.thread_pool( |
| 29 | + * std::make_shared<boost::network::utils::thread_pool>()); |
| 30 | + * http_server server(options.address("localhost").port("8000")); |
| 31 | + * \endcode |
| 32 | + * |
| 33 | +*/ |
40 | 34 | template<classHandler> |
41 | | -structserver : server_base<tags::http_server, Handler>::type { |
42 | | -typedeftypename server_base<tags::http_server, Handler>::type server_base; |
| 35 | +structserver : async_server_base<tags::http_server, Handler> { |
| 36 | +/// A convenience typedef for the base of this type, implementing most of |
| 37 | +/// the internal details. |
| 38 | +typedef async_server_base<tags::http_server, Handler> server_base; |
| 39 | + |
| 40 | +/// The options supported by the server. |
43 | 41 | typedef server_options<tags::http_server, Handler> options; |
44 | 42 |
|
45 | | -explicitserver(optionsconst &options) :server_base(options) {} |
| 43 | +using server_base::server_base; |
46 | 44 | }; |
47 | 45 |
|
48 | 46 | }// namespace http |
|