2014-11-19 00:25:21 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "acl_cpp/acl_cpp_define.hpp"
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
2016-02-05 10:10:24 +08:00
|
|
|
|
class dbuf_guard;
|
2014-11-19 00:25:21 +08:00
|
|
|
|
class string;
|
|
|
|
|
class ostream;
|
|
|
|
|
class socket_stream;
|
|
|
|
|
class http_header;
|
2015-08-18 20:58:56 +08:00
|
|
|
|
class http_client;
|
2014-11-19 00:25:21 +08:00
|
|
|
|
class HttpCookie;
|
2015-08-18 20:58:56 +08:00
|
|
|
|
class HttpServletRequest;
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> HTTP <EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><EFBFBD>࣬<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>̳У<EFBFBD><EFBFBD>û<EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
class ACL_CPP_API HttpServletResponse
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD>
|
|
|
|
|
* @param stream {socket_stream&} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
2016-02-05 10:10:24 +08:00
|
|
|
|
HttpServletResponse(socket_stream& stream);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
~HttpServletResponse(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param n {acl_int64} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>峤<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
2015-06-29 17:33:11 +08:00
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
HttpServletResponse& setContentLength(__int64 n);
|
|
|
|
|
#else
|
|
|
|
|
HttpServletResponse& setContentLength(long long int n);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP chunked <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
|
|
|
|
* @param on {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ true<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> setContentLength<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> chunked <EFBFBD><EFBFBD><EFBFBD>䷽ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP RFC <EFBFBD>淶Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* chunked <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><EFBFBD><EFBFBD> conteng-length <EFBFBD><EFBFBD>ʽ
|
|
|
|
|
* @return {HttpServletResponse&}
|
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& setChunkedTransferEncoding(bool on);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD>ͻ<EFBFBD><EFBFBD>˱<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param on {bool}
|
2015-08-18 20:58:56 +08:00
|
|
|
|
* @return {HttpServletResponse&}
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& setKeepAlive(bool on);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Content-Type <EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* text/html <EFBFBD><EFBFBD> text/html; charset=utf8 <EFBFBD><EFBFBD>ʽ
|
|
|
|
|
* @param value {const char*} <EFBFBD>ֶ<EFBFBD>ֵ
|
2015-08-18 20:58:56 +08:00
|
|
|
|
* @return {HttpServletResponse&}
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& setContentType(const char* value);
|
|
|
|
|
|
2015-08-18 20:58:56 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> gzip ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
* @param gzip {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> gzip ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
|
|
|
|
* @return {HttpServletResponse&}
|
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& setContentEncoding(bool gzip);
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD> setContentType <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٵ<EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param charset {const char*} <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
2015-08-18 20:58:56 +08:00
|
|
|
|
* @return {HttpServletResponse&}
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& setCharacterEncoding(const char* charset);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
* @param name {const char*} HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD>е<EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param value {time_t} ʱ<EFBFBD><EFBFBD>ֵ
|
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& setDateHeader(const char* name, time_t value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD>е<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
* @param name {const char*} HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD>е<EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param value {const char*} <EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& setHeader(const char* name, const char* value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
* @param name {const char*} HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD>е<EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param value {int} <EFBFBD>ֶ<EFBFBD>ֵ
|
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& setHeader(const char* name, int value);
|
|
|
|
|
|
2015-07-05 22:51:31 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>ƫ<EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD><EFBFBD>±<EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param from {http_off_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼƫ<EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD><EFBFBD>±<EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>㣩
|
|
|
|
|
* @param to {http_off_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>С<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD>ȣ<EFBFBD>
|
2015-08-18 20:58:56 +08:00
|
|
|
|
* @param total {http_off_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD>ȣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԴΪһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̬<EFBFBD>ļ<EFBFBD>ʱ<EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* Ӧ<EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܳ<EFBFBD><EFBFBD>ȴ<EFBFBD>С
|
2015-07-05 22:51:31 +08:00
|
|
|
|
* @return {HttpServletResponse&}
|
|
|
|
|
*/
|
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
|
|
|
|
HttpServletResponse& setRange(__int64 from,
|
|
|
|
|
__int64 to, __int64 total);
|
|
|
|
|
#else
|
|
|
|
|
HttpServletResponse& setRange(long long from,
|
|
|
|
|
long long to, long long total);
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD>е<EFBFBD>״̬<EFBFBD>룺1xx, 2xx, 3xx, 4xx, 5xx
|
|
|
|
|
* @param status {int} HTTP <EFBFBD><EFBFBD>Ӧ״̬<EFBFBD><EFBFBD>, <EFBFBD>磺200
|
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& setStatus(int status);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ CGI ģʽ<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>һ<EFBFBD>㲻<EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD>Ϊ HttpServlet <EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD> CGI ģʽ
|
|
|
|
|
* @param on {bool} <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD> CGI ģʽ
|
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& setCgiMode(bool on);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD>е<EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD> location <EFBFBD>ֶ<EFBFBD>
|
|
|
|
|
* @param location {const char*} URL<EFBFBD><EFBFBD><EFBFBD>ǿ<EFBFBD>
|
|
|
|
|
* @param status {int} HTTP <EFBFBD><EFBFBD>Ӧ״̬<EFBFBD>룬һ<EFBFBD><EFBFBD>Ϊ 3xx <EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& setRedirect(const char* location, int status = 302);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> cookie <EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>ͷŸö<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>ͷ<EFBFBD>
|
|
|
|
|
* @param cookie {HttpCookie*}
|
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& addCookie(HttpCookie* cookie);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> cookie
|
|
|
|
|
* @param name {const char*} cookie <EFBFBD><EFBFBD>
|
|
|
|
|
* @param value {const char*} cookie ֵ
|
|
|
|
|
* @param domain {const char*} cookie <EFBFBD>洢<EFBFBD><EFBFBD>
|
|
|
|
|
* @param path {const char*} cookie <EFBFBD>洢·<EFBFBD><EFBFBD>
|
|
|
|
|
* @param expires {time_t} cookie <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD>ֵΪ cookie <EFBFBD>Ĺ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)
|
|
|
|
|
*/
|
|
|
|
|
HttpServletResponse& addCookie(const char* name, const char* value,
|
|
|
|
|
const char* domain = NULL, const char* path = NULL,
|
|
|
|
|
time_t expires = 0);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD> url <EFBFBD><EFBFBD><EFBFBD><EFBFBD> url <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param out {string&} <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param url {const char*} δ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰԭʼ<EFBFBD><EFBFBD> url
|
|
|
|
|
*/
|
|
|
|
|
void encodeUrl(string& out, const char* url);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ
|
|
|
|
|
* @return {http_header&}
|
|
|
|
|
*/
|
|
|
|
|
http_header& getHttpHeader(void) const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD>˷<EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD> setChunkedTransferEncoding <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> chunked <EFBFBD><EFBFBD><EFBFBD>䷽ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD>ڲ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> chunked <EFBFBD><EFBFBD><EFBFBD>䷽ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* sendHeader <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>ڵ<EFBFBD>һ<EFBFBD><EFBFBD>
|
|
|
|
|
* дʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> chunked <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* Ӧ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٵ<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>α<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param data {const void*} <EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ַ
|
|
|
|
|
* @param len {size_t} data <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> false <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
bool write(const void* data, size_t len);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD>˷<EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HttpServletResponse::write(const void*, size_t) <EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>⣬<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> chunked <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٵ<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD>α<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-05-07 14:51:46 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>մ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> buf.empty() == true
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @param buf {const string&} <EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> false <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
bool write(const string& buf);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD> HTTP <EFBFBD>ͻ<EFBFBD><EFBFBD>˷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-08-18 20:58:56 +08:00
|
|
|
|
* HttpServletResponse::write(const void*, size_t) <EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>
|
|
|
|
|
* chunked <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٵ<EFBFBD><EFBFBD><EFBFBD> write(NULL, 0)
|
|
|
|
|
* <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @param fmt {const char*} <EFBFBD><EFBFBD><EFBFBD>θ<EFBFBD>ʽ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>ֵ > 0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1
|
|
|
|
|
*/
|
|
|
|
|
int format(const char* fmt, ...) ACL_CPP_PRINTF(2, 3);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD> HTTP <EFBFBD>ͻ<EFBFBD><EFBFBD>˷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-08-18 20:58:56 +08:00
|
|
|
|
* HttpServletResponse::write(const string&) <EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD> chunked
|
|
|
|
|
* <EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٵ<EFBFBD><EFBFBD><EFBFBD> write(NULL, 0) <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @param fmt {const char*} <EFBFBD><EFBFBD><EFBFBD>θ<EFBFBD>ʽ<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param ap {va_list} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
|
|
|
|
* @return {int} <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>ֵ > 0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1
|
|
|
|
|
*/
|
|
|
|
|
int vformat(const char* fmt, va_list ap);
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>Ӧ<EFBFBD>÷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP
|
|
|
|
|
* <EFBFBD><EFBFBD>Ӧͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {bool} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> false <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϣ<EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϼ<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD>ĺ<EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> getOutputStream <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> socket <EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
bool sendHeader(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD> sendHeader <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD>Ӧͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {ostream&}
|
|
|
|
|
*/
|
|
|
|
|
ostream& getOutputStream(void) const;
|
|
|
|
|
|
2015-08-18 20:58:56 +08:00
|
|
|
|
/**
|
2016-09-20 19:55:38 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP ˫<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD>캯<EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {socket_stream&}
|
2015-08-18 20:58:56 +08:00
|
|
|
|
*/
|
2016-09-20 19:55:38 +08:00
|
|
|
|
socket_stream& getSocketStream(void) const;
|
2015-08-18 20:58:56 +08:00
|
|
|
|
|
2015-09-27 20:59:21 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>õײ<EFBFBD><EFBFBD><EFBFBD> http_client ͨ<EFBFBD>Ŷ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {http_client*} <EFBFBD><EFBFBD> NULL
|
|
|
|
|
*/
|
|
|
|
|
http_client* getClient() const
|
|
|
|
|
{
|
|
|
|
|
return client_;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-20 19:55:38 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> http <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD>ĿǰֻӦ<EFBFBD><EFBFBD> HttpServlet <EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param request {HttpServletRequest*}
|
|
|
|
|
*/
|
|
|
|
|
void setHttpServletRequest(HttpServletRequest* request);
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
private:
|
2016-02-05 10:10:24 +08:00
|
|
|
|
dbuf_guard* dbuf_internal_;
|
|
|
|
|
dbuf_guard* dbuf_;
|
2014-11-19 00:25:21 +08:00
|
|
|
|
socket_stream& stream_; // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2015-08-18 20:58:56 +08:00
|
|
|
|
HttpServletRequest* request_; // http <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
http_client* client_; // http <20><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
http_header* header_; // http <20><>Ӧͷ
|
|
|
|
|
char charset_[32]; // <20>ַ<EFBFBD><D6B7><EFBFBD>
|
|
|
|
|
char content_type_[32]; // content-type <20><><EFBFBD><EFBFBD>
|
|
|
|
|
bool head_sent_; // <20>Ƿ<EFBFBD><C7B7>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <20><>Ӧͷ
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|