X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=include%2Fhttp%2Fipagehandler.h;h=16afb7c25333d65ddb47c27a4b3c9f1ccf0470c2;hb=221236a4d3aac4144529d418ce368db5c98facb0;hp=313aa564b2f386b7245024a6843c4baf448f8ad1;hpb=f208e33c29132aacaec448e74341edea1b925a2a;p=fms.git diff --git a/include/http/ipagehandler.h b/include/http/ipagehandler.h index 313aa56..16afb7c 100644 --- a/include/http/ipagehandler.h +++ b/include/http/ipagehandler.h @@ -1,37 +1,47 @@ #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; } + IPageHandler(const std::string &templatestr, const std::string &pagename):m_template(templatestr),m_pagename(pagename) { } virtual ~IPageHandler() {} + virtual const bool WillHandleURI(const std::string &uri); - /** - \brief Handles request for a page - - \return true if request was handled, false if it was ignored - */ - const bool Handle(shttpd_arg *arg); + virtual IPageHandler *New()=0; // returns a new instance of the object + + virtual void handleRequest(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response); private: - void HandlePost(shttpd_arg *arg); - void HadleGet(shttpd_arg *arg); - virtual const bool WillHandleURI(const std::string &uri)=0; virtual const std::string GeneratePage(const std::string &method, const std::map &queryvars)=0; - + protected: // 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); + + void CreateQueryVarMap(Poco::Net::HTTPServerRequest &request, std::map &vars); + + const std::string CreateFormPassword(); + const bool ValidateFormPassword(const std::map &vars); + + // replaces html elements with encoded characters (i.e. < becomes <) + const std::string SanitizeOutput(const std::string &input); std::string m_template; + std::string m_pagename; };