10 class HttpServletRequest;
120 if (path == NULL || *path == 0) {
124 return res.
write(buf.c_str(), buf.size()) && keep;
127 size_t len = strlen(path);
129 if (path[len - 1] !=
'/') {
134 std::map<acl::string, http_handler_t>::iterator it
135 = handlers_[type].find(buf);
137 if (it != handlers_[type].end()) {
138 return it->second(req, res) && keep;
144 buf +=
" not found\r\n";
146 return res.
write(buf.c_str(), buf.size()) && keep;
bool doPurge(HttpRequest &req, HttpResponse &res)
HttpServletResponse & setKeepAlive(bool on)
bool write(const void *data, size_t len)
bool doPut(HttpRequest &req, HttpResponse &res)
bool doPost(HttpRequest &req, HttpResponse &res)
bool doDelete(HttpRequest &req, HttpResponse &res)
bool doProfind(HttpRequest &req, HttpResponse &res)
HttpServletResponse & setStatus(int status)
std::function< bool(HttpRequest &, HttpResponse &)> http_handler_t
std::map< acl::string, http_handler_t > http_handlers_t
bool doGet(HttpRequest &req, HttpResponse &res)
const char * getPathInfo(void) const
bool doOptions(HttpRequest &req, HttpResponse &res)
bool doHead(HttpRequest &req, HttpResponse &res)
HttpServletRequest HttpRequest
bool doPatch(HttpRequest &req, HttpResponse &res)
bool doUnknown(HttpRequest &req, HttpResponse &res)
HttpServletResponse & setContentLength(long long int n)
bool doWebsocket(HttpRequest &req, HttpResponse &res)
bool isKeepAlive(void) const
http_servlet_impl(http_handlers_t *handlers, socket_stream *stream, session *session)
bool doConnect(HttpRequest &req, HttpResponse &res)
virtual ~http_servlet_impl(void)
bool doError(HttpRequest &req, HttpResponse &res)
HttpServletResponse HttpResponse