Mercurial > hg > orthanc
comparison Plugins/Engine/OrthancPlugins.cpp @ 1430:ad94a3583b07
Plugins can send answers as multipart messages
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 29 Jun 2015 17:47:34 +0200 |
parents | 97268448bdfc |
children | 461e7554bff7 |
comparison
equal
deleted
inserted
replaced
1429:7366a0bdda6a | 1430:ad94a3583b07 |
---|---|
424 error = callback(reinterpret_cast<OrthancPluginRestOutput*>(&output), | 424 error = callback(reinterpret_cast<OrthancPluginRestOutput*>(&output), |
425 flatUri.c_str(), | 425 flatUri.c_str(), |
426 &request); | 426 &request); |
427 } | 427 } |
428 | 428 |
429 if (error == 0 && | |
430 output.IsWritingMultipart()) | |
431 { | |
432 output.CloseMultipart(); | |
433 } | |
434 | |
429 if (error < 0) | 435 if (error < 0) |
430 { | 436 { |
431 LOG(ERROR) << "Plugin callback failed with error code " << error; | 437 LOG(ERROR) << "Plugin callback failed with error code " << error; |
432 return false; | 438 return false; |
433 } | 439 } |
1230 *reinterpret_cast<const _OrthancPluginReturnSingleValue*>(parameters); | 1236 *reinterpret_cast<const _OrthancPluginReturnSingleValue*>(parameters); |
1231 *(p.resultUint32) = ORTHANC_DATABASE_VERSION; | 1237 *(p.resultUint32) = ORTHANC_DATABASE_VERSION; |
1232 return true; | 1238 return true; |
1233 } | 1239 } |
1234 | 1240 |
1241 case _OrthancPluginService_StartMultipartAnswer: | |
1242 { | |
1243 const _OrthancPluginStartMultipartAnswer& p = | |
1244 *reinterpret_cast<const _OrthancPluginStartMultipartAnswer*>(parameters); | |
1245 HttpOutput* output = reinterpret_cast<HttpOutput*>(p.output); | |
1246 output->StartMultipart(p.subType, p.contentType); | |
1247 return true; | |
1248 } | |
1249 | |
1250 case _OrthancPluginService_SendMultipartItem: | |
1251 { | |
1252 // An exception might be raised in this function if the | |
1253 // connection was closed by the HTTP client. | |
1254 const _OrthancPluginAnswerBuffer& p = | |
1255 *reinterpret_cast<const _OrthancPluginAnswerBuffer*>(parameters); | |
1256 HttpOutput* output = reinterpret_cast<HttpOutput*>(p.output); | |
1257 output->SendMultipartItem(p.answer, p.answerSize); | |
1258 return true; | |
1259 } | |
1260 | |
1235 default: | 1261 default: |
1236 return false; | 1262 return false; |
1237 } | 1263 } |
1238 } | 1264 } |
1239 | 1265 |