NetServices Stack source
Dependents: HelloWorld ServoInterfaceBoardExample1 4180_Lab4
Diff: services/http/server/HTTPServer.h
- Revision:
- 5:dd63a1e02b1b
- Parent:
- 2:a4f97773c90f
- Child:
- 6:b7dd7cde8ad2
--- a/services/http/server/HTTPServer.h Fri Jul 09 14:46:47 2010 +0000 +++ b/services/http/server/HTTPServer.h Tue Jul 27 15:59:42 2010 +0000 @@ -37,9 +37,17 @@ #include <map> using std::map; +///A simple HTTP server implementation +/** +The HTTPServer is composed of: +- The actual server (HTTPServer) +- A request dispatcher, instanciated on each request (HTTPRequestDispatcher) +- Request handlers instanciated by the dispatcher(deriving from HTTPRequestHandler) +*/ class HTTPServer { public: + ///Instantiates the HTTP Server HTTPServer(); ~HTTPServer(); @@ -57,10 +65,21 @@ } }; + ///Adds a handler + /** + Appends a handler to the handlers list + @param T : class which will be instanciated to serve these requests + @param path : requests starting with this path will be served using this handler + */ template<typename T> void addHandler(const char* path) //Template decl in header { m_lpHandlers[path] = &T::inst; } + ///Starts listening + /** + Binds server to a specific port and starts listening + @param port : port on which to listen for incoming connections + */ void bind(int port = 80); private: