#ifndef __HTTPServer_h__ #define __HTTPServer_h__ #include "TCPServer.h" #include "HTTPSessions.h" #include "HTTPPageList.h" #include "HTTPConnection.h" #include "HTTPHandler.h" namespace http { class TCPSession; class HTTPServer : public core::TCPServer { public: HTTPServer(core::EPoll &ePoll, core::IPAddress ipAddress, HTTPSessions &httpSessions) : TCPServer(ePoll, ipAddress), httpSessions(httpSessions) { commands.add(getHandler, "GET"); commands.add(postHandler, "POST"); } core::TCPSession * getSocketAccept(core::EPoll &epoll) override { return new HTTPConnection(ePoll, *this); } HTTPSessions &httpSessions; HTTPPageList pageList; private: HTTPHandler getHandler; HTTPHandler postHandler; }; } #endif