Mercurial > hg > orthanc
comparison Core/RestApi/RestApiOutput.cpp @ 1521:3606278d305e
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 Aug 2015 13:37:24 +0200 |
parents | 8bd0d897763f |
children | 9c5d93510414 |
comparison
equal
deleted
inserted
replaced
1520:4a503a8c7749 | 1521:3606278d305e |
---|---|
93 { | 93 { |
94 #if ORTHANC_PUGIXML_ENABLED == 1 | 94 #if ORTHANC_PUGIXML_ENABLED == 1 |
95 std::string s; | 95 std::string s; |
96 Toolbox::JsonToXml(s, value); | 96 Toolbox::JsonToXml(s, value); |
97 output_.SetContentType("application/xml"); | 97 output_.SetContentType("application/xml"); |
98 output_.SendBody(s); | 98 output_.Answer(s); |
99 #else | 99 #else |
100 LOG(ERROR) << "Orthanc was compiled without XML support"; | 100 LOG(ERROR) << "Orthanc was compiled without XML support"; |
101 throw OrthancException(ErrorCode_InternalError); | 101 throw OrthancException(ErrorCode_InternalError); |
102 #endif | 102 #endif |
103 } | 103 } |
104 else | 104 else |
105 { | 105 { |
106 Json::StyledWriter writer; | 106 Json::StyledWriter writer; |
107 output_.SetContentType("application/json"); | 107 output_.SetContentType("application/json"); |
108 output_.SendBody(writer.write(value)); | 108 output_.Answer(writer.write(value)); |
109 } | 109 } |
110 | 110 |
111 alreadySent_ = true; | 111 alreadySent_ = true; |
112 } | 112 } |
113 | 113 |
122 size_t length, | 122 size_t length, |
123 const std::string& contentType) | 123 const std::string& contentType) |
124 { | 124 { |
125 CheckStatus(); | 125 CheckStatus(); |
126 output_.SetContentType(contentType.c_str()); | 126 output_.SetContentType(contentType.c_str()); |
127 output_.SendBody(buffer, length); | 127 output_.Answer(buffer, length); |
128 alreadySent_ = true; | 128 alreadySent_ = true; |
129 } | 129 } |
130 | 130 |
131 void RestApiOutput::Redirect(const std::string& path) | 131 void RestApiOutput::Redirect(const std::string& path) |
132 { | 132 { |