mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-15 01:10:52 +08:00
32 lines
679 B
C
32 lines
679 B
C
|
#pragma once
|
|||
|
|
|||
|
class HttpServlet : public acl::HttpServlet {
|
|||
|
public:
|
|||
|
HttpServlet(acl::socket_stream* stream, acl::session* session)
|
|||
|
: acl::HttpServlet(stream, session), i_(0) {}
|
|||
|
|
|||
|
~HttpServlet(void) {}
|
|||
|
|
|||
|
// override
|
|||
|
bool doGet(acl::HttpServletRequest& req, acl::HttpServletResponse& res) {
|
|||
|
return doPost(req, res);
|
|||
|
}
|
|||
|
|
|||
|
// override
|
|||
|
bool doPost(acl::HttpServletRequest& req, acl::HttpServletResponse& res) {
|
|||
|
static int __n = 0;
|
|||
|
|
|||
|
acl::string buf;
|
|||
|
buf.format("hello world, i=%d, n=%d", i_++, __n++);
|
|||
|
|
|||
|
res.setContentLength(buf.size());
|
|||
|
res.setKeepAlive(req.isKeepAlive());
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD> http <20><>Ӧ<EFBFBD><D3A6>
|
|||
|
return res.write(buf) && res.write(NULL, 0);
|
|||
|
}
|
|||
|
|
|||
|
private:
|
|||
|
int i_;
|
|||
|
};
|