Mercurial > hg > orthanc
comparison Core/HttpServer/HttpOutput.h @ 217:1ac3aacd10a5
simplifications
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 29 Nov 2012 12:22:23 +0100 |
parents | 7f74209ea0f8 |
children | 4031f73fe0e4 |
comparison
equal
deleted
inserted
replaced
216:e5d5d4a9a326 | 217:1ac3aacd10a5 |
---|---|
33 #pragma once | 33 #pragma once |
34 | 34 |
35 #include <string> | 35 #include <string> |
36 #include <stdint.h> | 36 #include <stdint.h> |
37 #include "../Enumerations.h" | 37 #include "../Enumerations.h" |
38 #include "../FileStorage.h" | |
39 | 38 |
40 namespace Orthanc | 39 namespace Orthanc |
41 { | 40 { |
42 class HttpOutput | 41 class HttpOutput |
43 { | 42 { |
44 private: | 43 private: |
45 void SendHeaderInternal(Orthanc_HttpStatus status); | 44 void SendHeaderInternal(Orthanc_HttpStatus status); |
46 | 45 |
46 void SendOkHeader(const char* contentType, | |
47 bool hasContentLength, | |
48 uint64_t contentLength, | |
49 const char* contentFilename); | |
50 | |
47 public: | 51 public: |
48 virtual ~HttpOutput() | 52 virtual ~HttpOutput() |
49 { | 53 { |
50 } | 54 } |
51 | 55 |
52 virtual void Send(const void* buffer, size_t length) = 0; | 56 virtual void Send(const void* buffer, size_t length) = 0; |
53 | |
54 void SendOkHeader(const std::string& contentType); | |
55 | |
56 void SendOkHeader(const char* contentType, | |
57 bool hasContentLength, | |
58 uint64_t contentLength, | |
59 const char* contentFilename); | |
60 | 57 |
61 void SendCustomOkHeader(const std::string& customHeader); | 58 void SendCustomOkHeader(const std::string& customHeader); |
62 | 59 |
63 void SendString(const std::string& s); | 60 void SendString(const std::string& s); |
64 | 61 |
65 void SendMethodNotAllowedError(const std::string& allowed); | 62 void SendMethodNotAllowedError(const std::string& allowed); |
66 | 63 |
67 void SendHeader(Orthanc_HttpStatus status); | 64 void SendHeader(Orthanc_HttpStatus status); |
68 | 65 |
66 void Redirect(const std::string& path); | |
69 | 67 |
70 // Higher-level constructs to send entire files or buffers ------------------- | 68 // Higher-level constructs to send entire buffers ---------------------------- |
71 | 69 |
72 void AnswerBufferWithContentType(const std::string& buffer, | 70 void AnswerBufferWithContentType(const std::string& buffer, |
73 const std::string& contentType); | 71 const std::string& contentType); |
74 | 72 |
75 void AnswerBufferWithContentType(const void* buffer, | 73 void AnswerBufferWithContentType(const void* buffer, |
76 size_t size, | 74 size_t size, |
77 const std::string& contentType); | 75 const std::string& contentType); |
78 | |
79 void AnswerFileWithContentType(const std::string& path, | |
80 const std::string& contentType, | |
81 const char* filename = NULL); | |
82 | |
83 void AnswerFileAutodetectContentType(const std::string& path, | |
84 const char* filename = NULL); | |
85 | |
86 void AnswerFile(const FileStorage& storage, | |
87 const std::string& uuid, | |
88 const std::string& contentType, | |
89 const char* filename = NULL); | |
90 | |
91 void Redirect(const std::string& path); | |
92 }; | 76 }; |
93 } | 77 } |