正在显示
1 个修改的文件
包含
63 行增加
和
0 行删除
src/server/dmpfilterresponsedecorator.cpp
0 → 100644
1 | +/************************************************************************** | |
2 | +* file: dmpfilterresponsedecorator.cpp | |
3 | + | |
4 | +* Author: wanzhongping | |
5 | +* Date: 2021-03-09 15:07:59 | |
6 | +* Email: zhongpingw@chinadci.com | |
7 | +* copyright: 广州城市信息研究所有限公司 | |
8 | +***************************************************************************/ | |
9 | +#define BOOST_BIND_GLOBAL_PLACEHOLDERS | |
10 | +#include "dmpconfig.h" | |
11 | +#include "dmpfilterresponsedecorator.h" | |
12 | +#include <iostream> | |
13 | +#include <boost/python.hpp> | |
14 | + | |
15 | +DmpFilterResponseDecorator::DmpFilterResponseDecorator(DmpServerFiltersMap filters, DmpServerResponse &response) | |
16 | + : filters_(filters), response_(response) | |
17 | +{ | |
18 | +} | |
19 | + | |
20 | +void DmpFilterResponseDecorator::Write(const std::string data) | |
21 | +{ | |
22 | + response_.Write(data); | |
23 | +} | |
24 | + | |
25 | +void DmpFilterResponseDecorator::WriteContent(const void * content, int length) | |
26 | +{ | |
27 | + response_.WriteContent(content, length); | |
28 | +} | |
29 | + | |
30 | +void DmpFilterResponseDecorator::Start() | |
31 | +{ | |
32 | + #ifdef HAVE_SERVER_PYTHON_PLUGINS | |
33 | + DmpServerFiltersMap::const_iterator filtersIterator; | |
34 | + for (filtersIterator = filters_.begin(); filtersIterator != filters_.end(); ++filtersIterator) | |
35 | + { | |
36 | + filtersIterator->second->RequestReady(); | |
37 | + } | |
38 | + #endif | |
39 | +} | |
40 | + | |
41 | +void DmpFilterResponseDecorator::Flush() | |
42 | +{ | |
43 | +#ifdef HAVE_SERVER_PYTHON_PLUGINS | |
44 | + DmpServerFiltersMap::const_iterator filtersIterator; | |
45 | + for (filtersIterator = filters_.begin(); filtersIterator != filters_.end(); ++filtersIterator) | |
46 | + { | |
47 | + filtersIterator->second->SendResponse(); | |
48 | + } | |
49 | +#endif | |
50 | + response_.Flush(); | |
51 | +} | |
52 | + | |
53 | +void DmpFilterResponseDecorator::Finish() | |
54 | +{ | |
55 | +#ifdef HAVE_SERVER_PYTHON_PLUGINS | |
56 | + DmpServerFiltersMap::const_iterator filtersIterator; | |
57 | + for (filtersIterator = filters_.begin(); filtersIterator != filters_.end(); ++filtersIterator) | |
58 | + { | |
59 | + filtersIterator->second->ResponseComplete(); | |
60 | + } | |
61 | +#endif | |
62 | + response_.Finish(); | |
63 | +} | |
\ No newline at end of file | ... | ... |
请
注册
或
登录
后发表评论