EthernetNetIf Compatibility.
Dependents: XBeeWiFi_SPI_example
Fork of NetServicesSource by
Diff: services/http/server/HTTPServer.h
- Revision:
- 2:a4f97773c90f
- Parent:
- 1:abb442332fa8
- Child:
- 5:dd63a1e02b1b
--- a/services/http/server/HTTPServer.h Mon Jun 14 10:33:54 2010 +0000 +++ b/services/http/server/HTTPServer.h Fri Jun 18 09:22:54 2010 +0000 @@ -42,6 +42,20 @@ public: HTTPServer(); ~HTTPServer(); + + struct handlersComp //Used to order handlers in the right way + { + bool operator() (const string& handler1, const string& handler2) const + { + //The first handler is longer than the second one + if (handler1.length() > handler2.length()) + return true; //Returns true if handler1 is to appear before handler2 + else if (handler1.length() < handler2.length()) + return false; + else //To avoid the == case, sort now by address + return ((&handler1)>(&handler2)); + } + }; template<typename T> void addHandler(const char* path) //Template decl in header @@ -55,7 +69,7 @@ void onTCPSocketEvent(TCPSocketEvent e); TCPSocket* m_pTCPSocket; - map< string, HTTPRequestHandler*(*)(const char*, const char*, TCPSocket*) > m_lpHandlers; + map< string, HTTPRequestHandler*(*)(const char*, const char*, TCPSocket*), handlersComp > m_lpHandlers; };