Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of HTTPServer by
Diff: LPC1768/services/http/server/HTTPServer.h
- Revision:
- 6:d753966e4d97
- Parent:
- 2:356c7fa399ae
--- a/LPC1768/services/http/server/HTTPServer.h Fri Jul 09 14:45:18 2010 +0000 +++ b/LPC1768/services/http/server/HTTPServer.h Thu Aug 05 15:12:27 2010 +0000 @@ -21,13 +21,17 @@ THE SOFTWARE. */ +/** \file +HTTP Server header file +*/ + #ifndef HTTP_SERVER_H #define HTTP_SERVER_H class HTTPRequestHandler; class HTTPRequestDispatcher; -#include "if/net/net.h" +#include "core/net.h" #include "HTTPRequestHandler.h" #include "HTTPRequestDispatcher.h" @@ -37,9 +41,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 +69,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: