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.
Dependents: SimpleLCDClock readCard2Twitter_http AnalogClock_StepperMotor_NTP ServoCamV1
Diff: services/http/server/HttpServer.h
- Revision:
- 0:a2dd0ba6cd2d
- Child:
- 1:7043cc0db03c
diff -r 000000000000 -r a2dd0ba6cd2d services/http/server/HttpServer.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/services/http/server/HttpServer.h Mon May 24 10:24:38 2010 +0000
@@ -0,0 +1,44 @@
+#ifndef HTTP_SERVER_H
+#define HTTP_SERVER_H
+
+class HttpRequestHandler;
+class HttpRequestDispatcher;
+
+#include "if/net/net.h"
+#include "HttpRequestHandler.h"
+#include "HttpRequestDispatcher.h"
+
+#include <string>
+using std::string;
+
+#include <map>
+using std::map;
+
+class HttpServer
+{
+public:
+ HttpServer();
+ ~HttpServer();
+
+ template<typename T>
+ void addHandler(const char* path) //Template decl in header
+ { m_lpHandlers[path] = &T::inst; }
+
+ void bind(int port = 80);
+
+private:
+ friend class HttpRequestDispatcher;
+
+ void onTcpSocketEvent(TcpSocketEvent e);
+
+ TcpSocket* m_pTcpSocket;
+ map< string, HttpRequestHandler*(*)(const char*, const char*, TcpSocket*) > m_lpHandlers;
+
+};
+
+//Including handlers here for more convenience
+#include "impl/RpcHandler.h"
+#include "impl/FSHandler.h"
+#include "impl/SimpleHandler.h"
+
+#endif