X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=include%2Fhttp%2Fipagehandler.h;h=745f72784a8a3a66f7146c10eb19ac25ffc302b6;hb=dec33c63afafabf83c3039e916725cac6faef9b3;hp=66e15b888d19545d9da47acae64f90b060eb93f3;hpb=14fff12d9df0ee30e2df4bf9d22c2e83065816df;p=fms.git diff --git a/include/http/ipagehandler.h b/include/http/ipagehandler.h index 66e15b8..745f727 100644 --- a/include/http/ipagehandler.h +++ b/include/http/ipagehandler.h @@ -1,38 +1,40 @@ #ifndef _ipagehandler_ #define _ipagehandler_ +#include "../ilogger.h" + +#include +#include +#include + #include #include #include #include -#include -class IPageHandler +class IPageHandler:public Poco::Net::HTTPRequestHandler,public ILogger { public: IPageHandler() {} IPageHandler(const std::string &templatestr) { m_template=templatestr; } virtual ~IPageHandler() {} + virtual const bool WillHandleURI(const std::string &uri)=0; + + virtual IPageHandler *New()=0; // returns a new instance of the object - /** - \brief Handles request for a page - - \return true if request was handled, false if it was ignored - */ - const bool Handle(shttpd_arg *arg); + virtual void handleRequest(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response); private: - virtual const bool WillHandleURI(const std::string &uri)=0; virtual const std::string GeneratePage(const std::string &method, const std::map &queryvars)=0; - + protected: - // splits apart data into name,data pairs in args map - void HandleMultiPartData(const std::string &contenttypeheader, char *data, const long datalen, std::map &args); // converts from basename[#] query args into a vector where the vector pos is the index pos # void CreateArgArray(const std::map &vars, const std::string &basename, std::vector &args); const std::string CreateTrueFalseDropDown(const std::string &name, const std::string &selected); - // replaces html control characters with elements (i.e. < becomes <) + void CreateQueryVarMap(Poco::Net::HTTPServerRequest &request, std::map &vars); + + // replaces html elements with encoded characters (i.e. < becomes <) const std::string SanitizeOutput(const std::string &input); std::string m_template;