Adbase
Adinf C++ base library V2
|
#include <Response.hpp>
Public Member Functions | |
Response (evhttp_request *req) | |
int | setHeader (const std::string &key, const std::string &value, bool isReplace=true) |
设置 header 信息 More... | |
int | addHeader (const std::string &key, const std::string &value) |
添加 header 信息 More... | |
void | setContent (const std::string &data) |
设置响应 body 信息 More... | |
void | appendContent (const std::string &data, bool isAfter=true) |
追加响应 body 信息 More... | |
void | sendReply (const std::string &reason="OK", int code=HTTP_OK, const std::string &data="") |
发送响应信息 More... | |
int | getCode () |
获取状态码 More... | |
size_t | getBodySize () |
获取响应数据大小 More... | |
virtual | ~Response () |
Definition at line 22 of file Response.hpp.
adbase::http::Response::Response | ( | evhttp_request * | req | ) |
Definition at line 9 of file Response.cpp.
|
inlinevirtual |
Definition at line 47 of file Response.hpp.
int adbase::http::Response::addHeader | ( | const std::string & | key, |
const std::string & | value | ||
) |
添加 header 信息
Definition at line 34 of file Response.cpp.
void adbase::http::Response::appendContent | ( | const std::string & | data, |
bool | isAfter = true |
||
) |
追加响应 body 信息
Definition at line 53 of file Response.cpp.
|
inline |
获取响应数据大小
Definition at line 45 of file Response.hpp.
Referenced by adbase::http::Server::onRequestCallback().
|
inline |
获取状态码
Definition at line 42 of file Response.hpp.
Referenced by adbase::http::Server::onRequestCallback().
void adbase::http::Response::sendReply | ( | const std::string & | reason = "OK" , |
int | code = HTTP_OK , |
||
const std::string & | data = "" |
||
) |
发送响应信息
Definition at line 65 of file Response.cpp.
References LOG_INFO.
Referenced by adbase::http::Server::onRequestCallback().
void adbase::http::Response::setContent | ( | const std::string & | data | ) |
设置响应 body 信息
Definition at line 42 of file Response.cpp.
int adbase::http::Response::setHeader | ( | const std::string & | key, |
const std::string & | value, | ||
bool | isReplace = true |
||
) |
设置 header 信息
Definition at line 17 of file Response.cpp.