@@ -101,16 +101,99 @@ in the following section.
101101Synchronous Servers
102102~~~~~~~~~~~~~~~~~~~
103103
104- .. FIXME show the table of tags that enable the synchronous implementation.
104+ The synchronous server implementation is represented by the template ``server ``
105+ in namespace ``boost::network::http ``. The ``server `` template takes in a single
106+ template parameter named ``Handler `` which models the SynchronousHandler
107+ concept (described above).
108+
109+ An instance of Handler is taken in by reference to the constructor of the HTTP
110+ server. This means the Handler is not copied around and only a single instance
111+ of the handler is used for all connections and requests performed against the
112+ HTTP server.
113+
114+ ..warning ::It is important to note that the HTTP server does not implement any
115+ locking upon invoking the Handler. In case you have any state in the Handler
116+ that will be associated with the synchronous server, you would have to
117+ implement your own synchronization internal to the Handler implementation.
118+ This matters especially if you run the synchronous server in multiple
119+ threads.
120+
121+ The general pattern of usage for the HTTP Server template is shown below:
122+
123+ ..code-block ::c++
124+
125+ struct handler;
126+ typedef boost::network::http: :server<handler> http_server;
127+
128+ struct handler {
129+ void operator()(
130+ http_server::request const & req,
131+ http_server::response & res
132+ ) {
133+ // do something, and then edit the res object here.
134+ }
135+ };
136+
137+ More information about the actual HTTP Server API follows in the next section.
138+ It is important to understand that the HTTP Server is actually embedded in your
139+ application, which means you can expose almost all your application logic
140+ through the Handler type, which you can also initialize appropriately.
141+
142+ API Documentation
143+ `````````````````
144+
145+ The following sections assume that the following file has been included:
146+
147+ ..code-block ::c++
148+
149+ #include <boost/network/include/http/server.hpp>
150+
151+ And that the following typedef's have been put in place:
152+
153+ ..code-block ::c++
154+
155+ struct handler_type;
156+ typedef boost::network::http: :server<handler_type> http_server;
157+
158+ Constructor
159+ ***********
160+
161+ ``http_server(address, port, handler) ``
162+ Construct an HTTP Server instance, passing in the address and port as
163+ ``std::string const & `` and handler being of type ``handler_type `` but
164+ passed in as an lvalue reference.
165+
166+ Public Members
167+ **************
168+
169+ The following definitions assume that a properly constructed ``http_server ``
170+ instance has been constructed in the following manner:
171+
172+ ..code-block ::c++
173+
174+ handler_type handler;
175+ http_server server("127.0.0.1", "8000", handler);
176+
177+ ``server.run() ``
178+ Run the HTTP Server event loop. This function can be run on multiple threads
179+ following the example:
180+
181+ ..code-block ::c++
182+
183+ boost::thread t1(boost::bind(&http_server::run, &server));
184+ boost::thread t2(boost::bind(&http_server::run, &server));
185+ server.run();
186+
187+ ``server.stop() ``
188+ Stop the HTTP Server acceptor and wait for all pending requests to finish.
105189
106190Asynchronous Servers
107191~~~~~~~~~~~~~~~~~~~~
108192
109193.. FIXME show the table of tags that enable the asynchronous implementation.
110194
111- Member Functions
112- ----------------
195+ API Documentation
196+ `````````````````
113197
114198.. FIXME show the table of publicly-accessible member functions.
115199
116-