+ build();
+}
+
+void Response::build(void) {
+ String b;
+ b.from(xml_code);
+ b = string("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n"
+ "<plaqui-response code=\"") + b + "\" version=\""
+ + xml_version + "\" ";
+ if (xml_description.length()) {
+ b += "description=\"" + xml_description + "\" ";
+ }
+ if (xml_contents.length()) {
+ b += ">\n" + xml_contents + "\n</plaqui-response>\n";
+ } else {
+ b += "/>\n";
+ }
+ set_body(b);
+ switch (xml_code) {
+ case OK:
+ status_code = HTTPMessage::OK;
+ break;
+ case INVALID_TARGET:
+ case INVALID_COMMAND:
+ case CONNECTION_NOT_FOUND:
+ case TRANSMISSION_NOT_FOUND:
+ case PLANT_NOT_FOUND:
+ case ELEMENT_NOT_FOUND:
+ case ELEMENT_INPUT_NOT_FOUND:
+ status_code = HTTPMessage::INTERNAL_SERVER_ERROR;
+ break;
+ case ALLREADY_EXISTS:
+ case ARGUMENT_MISSING:
+ status_code = HTTPMessage::CONFLICT;
+ break;
+ case UNKNOWN_ERROR:
+ case ERROR_STARTING_TRANSMISSION:
+ case ERROR_GETING_PLANT_XML:
+ case ERROR_CHANGING_ELEMENT_INPUT:
+ status_code = HTTPMessage::INTERNAL_SERVER_ERROR;
+ break;
+ default:
+ status_code = HTTPMessage::INTERNAL_SERVER_ERROR;
+ break;
+ }
+}
+
+const string& Response::get_version(void) const {
+ return xml_version;
+}
+
+const string& Response::set_version(const string& version_) {
+ xml_version = version_;
+ build();
+ return version_;
+}
+
+const Response::Code& Response::get_code(void) const {
+ return xml_code;
+}
+
+const Response::Code& Response::set_code(const Response::Code& code_) {
+ xml_code = code_;
+ build();
+ return code_;
+}
+
+const string& Response::get_description(void) const {
+ return xml_description;
+}
+
+const string& Response::set_description(const string& description_) {
+ xml_description = description_;
+ build();
+ return description_;
+}
+
+const string& Response::get_contents(void) const {
+ return xml_contents;
+}
+
+const string& Response::set_contents(const string& contents_) {
+ xml_contents = contents_;
+ build();
+ return contents_;