fastdo  0.6.8
webx_Response.hpp
浏览该文件的文档.
1 #pragma once
2 
3 #include "http.hpp"
4 #include "webx_OutputMgr.hpp"
5 
6 namespace eienwebx
7 {
8 
9 class Request;
10 
13 {
14 public:
16  ~Response();
17 
18  void echo( winux::String const & str );
19  void write( void const * data, int size );
20  void write( winux::Buffer const & buf );
21  void printf( char const * format, ... );
22 
24  void commitHeader();
28  void commit();
29 
30  winux::String getLocalEncoding() const;
31  winux::String getTargetEncoding() const;
32 
33  winux::String convFrom( winux::String const & str ) const;
34  winux::String convTo( winux::String const & str ) const;
35 
37  void setCharset( winux::String const & charset );
39  winux::String getCharset() const;
40 
42  void setMimeType( winux::String const & mime ) { _mimeType = mime; }
44  winux::String getMimeType() const { return _mimeType; }
45 
50  void setAutoContentType( bool autoContentType = true ) { _autoContentType = autoContentType; }
51 
57  void import( winux::String const & doFile, void * runParam = NULL, int * retCode = NULL );
58 
60  template < typename _Ty >
61  std::ostream & operator << ( _Ty const & v )
62  {
63  return _outputMgr->out() << v;
64  }
65 
67  OutputMgr * getOutputMgr() const { return _outputMgr.get(); }
68 
71 
72 private:
74  winux::String _mimeType;
75  bool _autoContentType;
76 
78 };
79 
80 
81 } // namespace eienwebx
代表HTTP头部
Definition: http_misc.hpp:10
#define EIENWEBX_DLL
winux::String getMimeType() const
获取MIME
XString< tchar > String
Definition: utilities.hpp:216
OutputMgr * getOutputMgr() const
暴露输出管理器
void setMimeType(winux::String const &mime)
设置MIME
Web功能的相关封装
std::ostream & operator<<(std::ostream &o, ConsoleAttrT< _VarType > const &tr)
Definition: console.hpp:137
#define DISABLE_OBJECT_COPY(clsname)
Definition: utilities.hpp:81
输出管理器
缓冲区,表示内存中一块二进制数据(利用malloc/realloc进行内存分配)
Definition: utilities.hpp:528
void setAutoContentType(bool autoContentType=true)
是否自动设置Content-Type
代表一个客户响应
http::Header & header
头部引用
代表一个请求
简单指针
Definition: smartptr.hpp:235
Request & request
Request对象的引用