|
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 | namespace boost { |
19 | 18 | namespace network { |
20 | 19 | namespace http { |
21 | 20 |
|
22 | | -template <class Tag, class Handler, class Enable = void> |
23 | | -struct server_base { |
24 | | - typedef unsupported_tag<Tag> type; |
25 | | -}; |
26 | | - |
27 | | -template <class Tag, class Handler> |
28 | | -struct server_base<Tag, Handler, typename enable_if<is_async<Tag> >::type> { |
29 | | - typedef async_server_base<Tag, Handler> type; |
30 | | -}; |
31 | | - |
32 | | -template <class Tag, class Handler> |
33 | | -struct server_base<Tag, Handler, typename enable_if<is_sync<Tag> >::type> { |
34 | | - typedef sync_server_base<Tag, Handler> type; |
35 | | -}; |
36 | | - |
37 | | -template <class Tag, class Handler> |
38 | | -struct basic_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 <class Handler> |
41 | | -struct server : server_base<tags::http_server, Handler>::type { |
42 | | - typedef typename server_base<tags::http_server, Handler>::type server_base; |
| 35 | +struct server : 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 | | - explicit server(options const &options) : server_base(options) {} |
| 43 | + using server_base::server_base; |
46 | 44 | }; |
47 | 45 |
|
48 | 46 | } // namespace http |
|
0 commit comments