Mercurial > hg > orthanc
annotate Core/HttpServer/HttpOutput.h @ 2887:342d5321a531 lscoder/fix-drawingdicomizer-jquery-path-1480725856237
closing branch
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 12 Oct 2018 15:20:11 +0200 |
parents | 5a8840920121 |
children | a3a65de1840f |
rev | line source |
---|---|
0 | 1 /** |
59 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1137
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
0 | 5 * |
6 * This program is free software: you can redistribute it and/or | |
7 * modify it under the terms of the GNU General Public License as | |
8 * published by the Free Software Foundation, either version 3 of the | |
9 * License, or (at your option) any later version. | |
136 | 10 * |
11 * In addition, as a special exception, the copyright holders of this | |
12 * program give permission to link the code of its release with the | |
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it | |
14 * that use the same license as the "OpenSSL" library), and distribute | |
15 * the linked executables. You must obey the GNU General Public License | |
16 * in all respects for all of the code used other than "OpenSSL". If you | |
17 * modify file(s) with this exception, you may extend this exception to | |
18 * your version of the file(s), but you are not obligated to do so. If | |
19 * you do not wish to do so, delete this exception statement from your | |
20 * version. If you delete this exception statement from all source files | |
21 * in the program, then also delete it here. | |
0 | 22 * |
23 * This program is distributed in the hope that it will be useful, but | |
24 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
26 * General Public License for more details. | |
27 * | |
28 * You should have received a copy of the GNU General Public License | |
29 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
30 **/ | |
31 | |
32 | |
33 #pragma once | |
34 | |
2142 | 35 #include "../Enumerations.h" |
36 #include "IHttpOutputStream.h" | |
37 #include "IHttpStreamAnswer.h" | |
38 | |
330 | 39 #include <list> |
0 | 40 #include <string> |
41 #include <stdint.h> | |
2142 | 42 #include <map> |
0 | 43 |
59 | 44 namespace Orthanc |
0 | 45 { |
912
dcb2469f00f4
PluginsHttpHandler::RestApiGet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
911
diff
changeset
|
46 class HttpOutput : public boost::noncopyable |
0 | 47 { |
48 private: | |
330 | 49 typedef std::list< std::pair<std::string, std::string> > Header; |
50 | |
910 | 51 class StateMachine : public boost::noncopyable |
52 { | |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
53 public: |
910 | 54 enum State |
55 { | |
56 State_WritingHeader, | |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
57 State_WritingBody, |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
58 State_WritingMultipart, |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
59 State_Done |
910 | 60 }; |
61 | |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
62 private: |
910 | 63 IHttpOutputStream& stream_; |
64 State state_; | |
65 | |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
66 HttpStatus status_; |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
67 bool hasContentLength_; |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
68 uint64_t contentLength_; |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
69 uint64_t contentPosition_; |
1115
da56a7916e8a
Experimental "KeepAlive" configuration option to enable HTTP Keep-Alive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1113
diff
changeset
|
70 bool keepAlive_; |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
71 std::list<std::string> headers_; |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
72 |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
73 std::string multipartBoundary_; |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
74 std::string multipartContentType_; |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
75 |
910 | 76 public: |
1115
da56a7916e8a
Experimental "KeepAlive" configuration option to enable HTTP Keep-Alive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1113
diff
changeset
|
77 StateMachine(IHttpOutputStream& stream, |
da56a7916e8a
Experimental "KeepAlive" configuration option to enable HTTP Keep-Alive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1113
diff
changeset
|
78 bool isKeepAlive); |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
79 |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
80 ~StateMachine(); |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
81 |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
82 void SetHttpStatus(HttpStatus status); |
910 | 83 |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
84 void SetContentLength(uint64_t length); |
910 | 85 |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
86 void SetContentType(const char* contentType); |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
87 |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
88 void SetContentFilename(const char* filename); |
910 | 89 |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
90 void SetCookie(const std::string& cookie, |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
91 const std::string& value); |
910 | 92 |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
93 void AddHeader(const std::string& header, |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
94 const std::string& value); |
910 | 95 |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
96 void ClearHeaders(); |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
97 |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
98 void SendBody(const void* buffer, size_t length); |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
99 |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
100 void StartMultipart(const std::string& subType, |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
101 const std::string& contentType); |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
102 |
1882
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1645
diff
changeset
|
103 void SendMultipartItem(const void* item, |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1645
diff
changeset
|
104 size_t length, |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1645
diff
changeset
|
105 const std::map<std::string, std::string>& headers); |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
106 |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
107 void CloseMultipart(); |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
108 |
1519
8bd0d897763f
refactoring: IHttpStreamAnswer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1517
diff
changeset
|
109 void CloseBody(); |
8bd0d897763f
refactoring: IHttpStreamAnswer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1517
diff
changeset
|
110 |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
111 State GetState() const |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
112 { |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
113 return state_; |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
114 } |
910 | 115 }; |
116 | |
117 StateMachine stateMachine_; | |
1517 | 118 bool isDeflateAllowed_; |
119 bool isGzipAllowed_; | |
120 | |
121 HttpCompression GetPreferredCompression(size_t bodySize) const; | |
908
e078ea944089
refactoring HttpOutput
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
122 |
0 | 123 public: |
1115
da56a7916e8a
Experimental "KeepAlive" configuration option to enable HTTP Keep-Alive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1113
diff
changeset
|
124 HttpOutput(IHttpOutputStream& stream, |
da56a7916e8a
Experimental "KeepAlive" configuration option to enable HTTP Keep-Alive
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1113
diff
changeset
|
125 bool isKeepAlive) : |
1517 | 126 stateMachine_(stream, isKeepAlive), |
127 isDeflateAllowed_(false), | |
1645
1558b3226b18
IHttpExceptionFormatter
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1592
diff
changeset
|
128 isGzipAllowed_(false) |
1517 | 129 { |
130 } | |
131 | |
132 void SetDeflateAllowed(bool allowed) | |
0 | 133 { |
1517 | 134 isDeflateAllowed_ = allowed; |
135 } | |
136 | |
137 bool IsDeflateAllowed() const | |
138 { | |
139 return isDeflateAllowed_; | |
140 } | |
141 | |
142 void SetGzipAllowed(bool allowed) | |
143 { | |
144 isGzipAllowed_ = allowed; | |
145 } | |
146 | |
147 bool IsGzipAllowed() const | |
148 { | |
149 return isGzipAllowed_; | |
0 | 150 } |
151 | |
1567
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
152 void SendStatus(HttpStatus status, |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
153 const char* message, |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
154 size_t messageSize); |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
155 |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
156 void SendStatus(HttpStatus status) |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
157 { |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
158 SendStatus(status, NULL, 0); |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
159 } |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
160 |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
161 void SendStatus(HttpStatus status, |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
162 const std::string& message) |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
163 { |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
164 SendStatus(status, message.c_str(), message.size()); |
9c5d93510414
If error while calling the REST API, the answer body contains an error description
jodogne
parents:
1521
diff
changeset
|
165 } |
285
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
166 |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
167 void SetContentType(const char* contentType) |
908
e078ea944089
refactoring HttpOutput
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
168 { |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
169 stateMachine_.SetContentType(contentType); |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
170 } |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
171 |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
172 void SetContentFilename(const char* filename) |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
173 { |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
174 stateMachine_.SetContentFilename(filename); |
908
e078ea944089
refactoring HttpOutput
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
175 } |
e078ea944089
refactoring HttpOutput
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
176 |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
177 void SetCookie(const std::string& cookie, |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
178 const std::string& value) |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
179 { |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
180 stateMachine_.SetCookie(cookie, value); |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
181 } |
0 | 182 |
1137
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1115
diff
changeset
|
183 void AddHeader(const std::string& key, |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1115
diff
changeset
|
184 const std::string& value) |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1115
diff
changeset
|
185 { |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1115
diff
changeset
|
186 stateMachine_.AddHeader(key, value); |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1115
diff
changeset
|
187 } |
d9c27f9f1a51
OrthancPluginSetHttpHeader
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1115
diff
changeset
|
188 |
1521 | 189 void Answer(const void* buffer, |
190 size_t length); | |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
191 |
1521 | 192 void Answer(const std::string& str); |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
193 |
1521 | 194 void AnswerEmpty(); |
1113
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
195 |
ba5c0908600c
Refactoring of HttpOutput ("Content-Length" header is now always sent)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1042
diff
changeset
|
196 void SendMethodNotAllowed(const std::string& allowed); |
0 | 197 |
217 | 198 void Redirect(const std::string& path); |
0 | 199 |
908
e078ea944089
refactoring HttpOutput
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
689
diff
changeset
|
200 void SendUnauthorized(const std::string& realm); |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
201 |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
202 void StartMultipart(const std::string& subType, |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
203 const std::string& contentType) |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
204 { |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
205 stateMachine_.StartMultipart(subType, contentType); |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
206 } |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
207 |
1882
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1645
diff
changeset
|
208 void SendMultipartItem(const void* item, |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1645
diff
changeset
|
209 size_t size, |
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1645
diff
changeset
|
210 const std::map<std::string, std::string>& headers) |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
211 { |
1882
5cf2bd0abfa2
OrthancPluginSendMultipartItem2 for DICOMweb
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1645
diff
changeset
|
212 stateMachine_.SendMultipartItem(item, size, headers); |
1430
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
213 } |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
214 |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
215 void CloseMultipart() |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
216 { |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
217 stateMachine_.CloseMultipart(); |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
218 } |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
219 |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
220 bool IsWritingMultipart() const |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
221 { |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
222 return stateMachine_.GetState() == StateMachine::State_WritingMultipart; |
ad94a3583b07
Plugins can send answers as multipart messages
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
223 } |
1519
8bd0d897763f
refactoring: IHttpStreamAnswer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1517
diff
changeset
|
224 |
8bd0d897763f
refactoring: IHttpStreamAnswer
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1517
diff
changeset
|
225 void Answer(IHttpStreamAnswer& stream); |
0 | 226 }; |
227 } |