2017-07-20 23:26:51 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
class http_servlet : public acl::HttpServlet
|
|
|
|
{
|
|
|
|
public:
|
2017-07-22 21:32:21 +08:00
|
|
|
http_servlet(acl::socket_stream*, acl::session*,
|
|
|
|
const char* addr, const char* path);
|
2017-07-20 23:26:51 +08:00
|
|
|
~http_servlet();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// @override
|
|
|
|
bool doError(acl::HttpServletRequest&, acl::HttpServletResponse&);
|
|
|
|
|
|
|
|
// @override
|
|
|
|
bool doOther(acl::HttpServletRequest&,
|
|
|
|
acl::HttpServletResponse&, const char* method);
|
|
|
|
|
|
|
|
// @override
|
|
|
|
bool doGet(acl::HttpServletRequest&, acl::HttpServletResponse&);
|
|
|
|
|
|
|
|
// @override
|
|
|
|
bool doPost(acl::HttpServletRequest&, acl::HttpServletResponse&);
|
|
|
|
|
|
|
|
private:
|
|
|
|
acl::string addr_;
|
2017-07-22 21:32:21 +08:00
|
|
|
acl::string conf_;
|
2017-07-20 23:26:51 +08:00
|
|
|
|
|
|
|
bool replyf(acl::HttpServletRequest&,
|
|
|
|
acl::HttpServletResponse&, int status, const char* fmt, ...);
|
|
|
|
bool reply(acl::HttpServletRequest&,
|
|
|
|
acl::HttpServletResponse&, int status, const acl::string&);
|
|
|
|
bool reply_json(acl::HttpServletRequest&, acl::HttpServletResponse&,
|
|
|
|
int status, const acl::string&);
|
|
|
|
};
|