| 85 | } |
| 86 | |
| 87 | bool doResponse(acl::HttpServletRequest& req, acl::HttpServletResponse& res) |
| 88 | { |
| 89 | // �������������� cookie ֵ |
| 90 | const char* cookie1 = req.getCookieValue("name1"); |
| 91 | const char* cookie2 = req.getCookieValue("name2"); |
| 92 | |
| 93 | // ���� xml ��ʽ�������� |
| 94 | acl::xml1 body; |
| 95 | body.get_root().add_child("root", true) |
| 96 | .add_child("content_type", true) |
| 97 | .add_attr("type", (int) req.getRequestType()) |
| 98 | .get_parent() |
| 99 | .add_child("cookies", true) |
| 100 | .add_child("cookie", true) |
| 101 | .add_attr("name1", cookie1 ? cookie1 : "null") |
| 102 | .get_parent() |
| 103 | .add_child("cookie", true) |
| 104 | .add_attr("name2", cookie2 ? cookie2 : "null") |
| 105 | .get_parent() |
| 106 | .get_parent() |
| 107 | .add_child("params", true) |
| 108 | .add_child("param", true) |
| 109 | .add_attr("name1", param1_ ? param1_ : "null") |
| 110 | .get_parent() |
| 111 | .add_child("param", true) |
| 112 | .add_attr("name2", param2_ ? param2_ : "null") |
| 113 | .get_parent() |
| 114 | .add_child("param", true) |
| 115 | .add_attr("name3", param3_ ? param3_ : "null") |
| 116 | .get_parent() |
| 117 | .get_parent() |
| 118 | .add_child("files", true) |
| 119 | .add_child("file", true) |
| 120 | .add_attr("filename", file1_ ? file1_ : "null") |
| 121 | .get_parent() |
| 122 | .add_child("file", true) |
| 123 | .add_attr("filename", file2_ ? file2_ : "null") |
| 124 | .get_parent() |
| 125 | .add_child("file", true) |
| 126 | .add_attr("filename", file3_ ? file3_ : "null"); |
| 127 | acl::string buf("<?xml version=\"1.0\"?>"); |
| 128 | body.build_xml(buf); |
| 129 | |
| 130 | //printf(">>>response: %s\r\n", buf.c_str()); |
| 131 | //res.setContentLength(buf.length()); |
| 132 | |
| 133 | // ������ʾ������������������� http ��Ӧͷ |
| 134 | //if (res.sendHeader() == false) |
| 135 | // return false; |
| 136 | // ���� http ��Ӧ�壬��ʹ�� chunk ����ʱ������������һ�η��Ϳ����� |
| 137 | if (res.write(buf) == false || res.write(NULL, 0) == false) { |
| 138 | return false; |
| 139 | } |
| 140 | return true; |
| 141 | } |
| 142 | |
| 143 | // GET ��ʽ�� POST ��ʽ�����㣺 |
| 144 | // Content-Type: application/x-www-form-urlencoded |
nothing calls this directly
no test coverage detected