alaCarte Maps
Renderer for OpenStreetMap tiles
HttpServer Class Reference

A HttpServer waits for connections and creates HttpRequests. More...

#include <http_server.hpp>

Inheritance diagram for HttpServer:

Public Member Functions

 HttpServer (const shared_ptr< Configuration > &config, const shared_ptr< RequestManager > &manager)
 This file is part of alaCarte. More...
 
TESTABLE void listen ()
 The HttpServer starts listening for new connections. More...
 
TESTABLE void quit ()
 Cleans up the HttpServer. More...
 
void stopRequest (shared_ptr< HttpRequest > request)
 Stops a HttpRequest and deletes it from the request list. More...
 

Private Member Functions

void start_accept ()
 Prepares the HttpServer for a new connection and waits asynchronous for it. More...
 
void handle_accept (const boost::system::error_code &e)
 Called when a new client connects to the server. More...
 

Private Attributes

boost::asio::io_service io_service
 The io_service used to perform asynchronous operations. More...
 
boost::asio::signal_set signals
 The signal_set is used to register process termination notifications. More...
 
boost::asio::ip::tcp::acceptor acceptor
 Acceptor used to listen for incoming requests. More...
 
shared_ptr< HttpRequestnextRequest
 The next connection to be accepted. More...
 
std::set< shared_ptr< HttpRequest > > requests
 The managed requests. More...
 
shared_ptr< Configurationconfig
 
shared_ptr< RequestManagermanager
 

Detailed Description

A HttpServer waits for connections and creates HttpRequests.

Definition at line 37 of file http_server.hpp.

Constructor & Destructor Documentation

HttpServer::HttpServer ( const shared_ptr< Configuration > &  config,
const shared_ptr< RequestManager > &  manager 
)

This file is part of alaCarte.

alaCarte is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

alaCarte is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with alaCarte. If not, see http://www.gnu.org/licenses/.

Copyright alaCarte 2012-2013 Simon Dreher, Florian Jacob, Tobias Kahlert, Patrick Niklaus, Bernhard Scheirle, Lisa Winter Maintainer: Bernhard Scheirle Creates a new HttpServer with the given Configuration and RequestManager

Parameters
configThe Configuration which should be used
managerThe RequestManager in which the HttpRequest should be enqueued.

Definition at line 35 of file http_server.cpp.

Member Function Documentation

void HttpServer::handle_accept ( const boost::system::error_code &  e)
private

Called when a new client connects to the server.

Definition at line 109 of file http_server.cpp.

void HttpServer::listen ( )

The HttpServer starts listening for new connections.

This function will never return (Blocking call).

Definition at line 57 of file http_server.cpp.

void HttpServer::quit ( )

Cleans up the HttpServer.

Called when the HttpServer should be terminated.

Definition at line 131 of file http_server.cpp.

void HttpServer::start_accept ( )
private

Prepares the HttpServer for a new connection and waits asynchronous for it.

Definition at line 101 of file http_server.cpp.

void HttpServer::stopRequest ( shared_ptr< HttpRequest request)

Stops a HttpRequest and deletes it from the request list.

Parameters
requestThe HttpRequest which should be stopped.

Definition at line 93 of file http_server.cpp.

Member Data Documentation

boost::asio::ip::tcp::acceptor HttpServer::acceptor
private

Acceptor used to listen for incoming requests.

Definition at line 58 of file http_server.hpp.

shared_ptr<Configuration> HttpServer::config
private

Definition at line 66 of file http_server.hpp.

boost::asio::io_service HttpServer::io_service
private

The io_service used to perform asynchronous operations.

Definition at line 52 of file http_server.hpp.

shared_ptr<RequestManager> HttpServer::manager
private

Definition at line 67 of file http_server.hpp.

shared_ptr<HttpRequest> HttpServer::nextRequest
private

The next connection to be accepted.

Definition at line 61 of file http_server.hpp.

std::set<shared_ptr<HttpRequest> > HttpServer::requests
private

The managed requests.

Definition at line 64 of file http_server.hpp.

boost::asio::signal_set HttpServer::signals
private

The signal_set is used to register process termination notifications.

Definition at line 55 of file http_server.hpp.


The documentation for this class was generated from the following files: