Mercurial > hg > orthanc
annotate Core/HttpServer/HttpOutput.h @ 932:330aa746bd29
integration mac -> default
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 24 Jun 2014 17:03:52 +0200 |
parents | 2d0a347e8cfc |
children | e078ea944089 |
rev | line source |
---|---|
0 | 1 /** |
59 | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
689 | 3 * Copyright (C) 2012-2014 Medical Physics Department, CHU of Liege, |
0 | 4 * Belgium |
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 | |
330 | 35 #include <list> |
0 | 36 #include <string> |
37 #include <stdint.h> | |
38 #include "../Enumerations.h" | |
324 | 39 #include "HttpHandler.h" |
0 | 40 |
59 | 41 namespace Orthanc |
0 | 42 { |
43 class HttpOutput | |
44 { | |
45 private: | |
330 | 46 typedef std::list< std::pair<std::string, std::string> > Header; |
47 | |
473
c9a5d72f8481
changing the namespace of HTTP enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
48 void SendHeaderInternal(HttpStatus status); |
0 | 49 |
330 | 50 void PrepareOkHeader(Header& header, |
51 const char* contentType, | |
52 bool hasContentLength, | |
53 uint64_t contentLength, | |
54 const char* contentFilename); | |
55 | |
56 void SendOkHeader(const Header& header); | |
57 | |
339 | 58 void PrepareCookies(Header& header, |
59 const HttpHandler::Arguments& cookies); | |
60 | |
0 | 61 public: |
62 virtual ~HttpOutput() | |
63 { | |
64 } | |
65 | |
66 virtual void Send(const void* buffer, size_t length) = 0; | |
67 | |
285
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
68 void SendOkHeader(const char* contentType, |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
69 bool hasContentLength, |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
70 uint64_t contentLength, |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
71 const char* contentFilename); |
4031f73fe0e4
access to the raw dicom tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
217
diff
changeset
|
72 |
155
93e1b0e3b83a
filenames when downloading json/dicom
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
136
diff
changeset
|
73 void SendString(const std::string& s); |
0 | 74 |
75 void SendMethodNotAllowedError(const std::string& allowed); | |
76 | |
473
c9a5d72f8481
changing the namespace of HTTP enumerations
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
398
diff
changeset
|
77 void SendHeader(HttpStatus status); |
0 | 78 |
217 | 79 void Redirect(const std::string& path); |
0 | 80 |
217 | 81 // Higher-level constructs to send entire buffers ---------------------------- |
0 | 82 |
83 void AnswerBufferWithContentType(const std::string& buffer, | |
84 const std::string& contentType); | |
85 | |
330 | 86 void AnswerBufferWithContentType(const std::string& buffer, |
87 const std::string& contentType, | |
88 const HttpHandler::Arguments& cookies); | |
89 | |
0 | 90 void AnswerBufferWithContentType(const void* buffer, |
91 size_t size, | |
92 const std::string& contentType); | |
339 | 93 |
94 void AnswerBufferWithContentType(const void* buffer, | |
95 size_t size, | |
96 const std::string& contentType, | |
97 const HttpHandler::Arguments& cookies); | |
0 | 98 }; |
99 } |