MCPcopy Create free account
hub / github.com/acl-dev/acl / doResponse

Method doResponse

lib_acl_cpp/samples/cgi_upload/main.cpp:71–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69 }
70
71 bool doResponse(HttpServletRequest& req, HttpServletResponse& res)
72 {
73 // �������������� cookie ֵ
74 const char* cookie1 = req.getCookieValue("name1");
75 const char* cookie2 = req.getCookieValue("name2");
76
77 // ��� sid session ֵ
78#if 0
79 const char* sid = req.getSession().getAttribute("sid");
80#else
81 const char* sid = "test_sid";
82#endif
83
84 // ���� xml ��ʽ��������
85 xml1 body;
86 body.get_root().add_child("root", true)
87 .add_child("content_type", true)
88 .add_attr("type", (int) req.getRequestType())
89 .get_parent()
90 .add_child("sessions", true)
91 .add_child("session", true)
92 .add_attr("sid", sid ? sid : "null")
93 .get_parent()
94 .get_parent()
95 .add_child("cookies", true)
96 .add_child("cookie", true)
97 .add_attr("name1", cookie1 ? cookie1 : "null")
98 .get_parent()
99 .add_child("cookie", true)
100 .add_attr("name2", cookie2 ? cookie2 : "null")
101 .get_parent()
102 .get_parent()
103 .add_child("params", true)
104 .add_child("param", true)
105 .add_attr("name1", param1_ ? param1_ : "null")
106 .get_parent()
107 .add_child("param", true)
108 .add_attr("name2", param2_ ? param2_ : "null")
109 .get_parent()
110 .add_child("param", true)
111 .add_attr("name3", param3_ ? param3_ : "null")
112 .get_parent()
113 .get_parent()
114 .add_child("files", true)
115 .add_child("file", true)
116 .add_attr("filename", file1_ ? file1_ : "null")
117 .get_parent()
118 .add_child("file", true)
119 .add_attr("filename", file2_ ? file2_ : "null")
120 .get_parent()
121 .add_child("file", true)
122 .add_attr("filename", file3_ ? file3_ : "null");
123 string buf;
124 body.build_xml(buf);
125
126 // ���� http ��Ӧͷ
127 if (res.sendHeader() == false)
128 return false;

Callers

nothing calls this directly

Calls 7

getCookieValueMethod · 0.80
getAttributeMethod · 0.80
get_parentMethod · 0.80
getRequestTypeMethod · 0.80
sendHeaderMethod · 0.80
build_xmlMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected