Mercurial > hg > orthanc
comparison Plugins/Engine/OrthancPlugins.cpp @ 1882:5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 09 Dec 2015 09:29:05 +0100 |
parents | a7bea843a7bc |
children | b1291df2f780 |
comparison
equal
deleted
inserted
replaced
1881:d2efbe076653 | 1882:5cf2bd0abfa2 |
---|---|
1572 throw OrthancException(ErrorCode_InternalError); | 1572 throw OrthancException(ErrorCode_InternalError); |
1573 } | 1573 } |
1574 | 1574 |
1575 *(p.target) = ReturnImage(result); | 1575 *(p.target) = ReturnImage(result); |
1576 } | 1576 } |
1577 | 1577 |
1578 | |
1579 void OrthancPlugins::ApplySendMultipartItem(const void* parameters) | |
1580 { | |
1581 // An exception might be raised in this function if the | |
1582 // connection was closed by the HTTP client. | |
1583 const _OrthancPluginAnswerBuffer& p = | |
1584 *reinterpret_cast<const _OrthancPluginAnswerBuffer*>(parameters); | |
1585 | |
1586 HttpOutput* output = reinterpret_cast<HttpOutput*>(p.output); | |
1587 | |
1588 std::map<std::string, std::string> headers; // No custom headers | |
1589 output->SendMultipartItem(p.answer, p.answerSize, headers); | |
1590 } | |
1591 | |
1592 | |
1593 void OrthancPlugins::ApplySendMultipartItem2(const void* parameters) | |
1594 { | |
1595 // An exception might be raised in this function if the | |
1596 // connection was closed by the HTTP client. | |
1597 const _OrthancPluginSendMultipartItem2& p = | |
1598 *reinterpret_cast<const _OrthancPluginSendMultipartItem2*>(parameters); | |
1599 HttpOutput* output = reinterpret_cast<HttpOutput*>(p.output); | |
1600 | |
1601 std::map<std::string, std::string> headers; | |
1602 for (uint32_t i = 0; i < p.headersCount; i++) | |
1603 { | |
1604 headers[p.headersKeys[i]] = p.headersValues[i]; | |
1605 } | |
1606 | |
1607 output->SendMultipartItem(p.answer, p.answerSize, headers); | |
1608 } | |
1609 | |
1578 | 1610 |
1579 void OrthancPlugins::DatabaseAnswer(const void* parameters) | 1611 void OrthancPlugins::DatabaseAnswer(const void* parameters) |
1580 { | 1612 { |
1581 const _OrthancPluginDatabaseAnswer& p = | 1613 const _OrthancPluginDatabaseAnswer& p = |
1582 *reinterpret_cast<const _OrthancPluginDatabaseAnswer*>(parameters); | 1614 *reinterpret_cast<const _OrthancPluginDatabaseAnswer*>(parameters); |
1967 output->StartMultipart(p.subType, p.contentType); | 1999 output->StartMultipart(p.subType, p.contentType); |
1968 return true; | 2000 return true; |
1969 } | 2001 } |
1970 | 2002 |
1971 case _OrthancPluginService_SendMultipartItem: | 2003 case _OrthancPluginService_SendMultipartItem: |
1972 { | 2004 ApplySendMultipartItem(parameters); |
1973 // An exception might be raised in this function if the | 2005 return true; |
1974 // connection was closed by the HTTP client. | 2006 |
1975 const _OrthancPluginAnswerBuffer& p = | 2007 case _OrthancPluginService_SendMultipartItem2: |
1976 *reinterpret_cast<const _OrthancPluginAnswerBuffer*>(parameters); | 2008 ApplySendMultipartItem2(parameters); |
1977 HttpOutput* output = reinterpret_cast<HttpOutput*>(p.output); | 2009 return true; |
1978 output->SendMultipartItem(p.answer, p.answerSize); | |
1979 return true; | |
1980 } | |
1981 | 2010 |
1982 case _OrthancPluginService_ReadFile: | 2011 case _OrthancPluginService_ReadFile: |
1983 { | 2012 { |
1984 const _OrthancPluginReadFile& p = | 2013 const _OrthancPluginReadFile& p = |
1985 *reinterpret_cast<const _OrthancPluginReadFile*>(parameters); | 2014 *reinterpret_cast<const _OrthancPluginReadFile*>(parameters); |