Mercurial > hg > orthanc
comparison Core/RestApi/RestApiOutput.cpp @ 1518:eb46cc06389a
cont
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 Aug 2015 10:36:05 +0200 |
parents | 4f8c8ef114db |
children | 8bd0d897763f |
comparison
equal
deleted
inserted
replaced
1517:4f8c8ef114db | 1518:eb46cc06389a |
---|---|
43 { | 43 { |
44 RestApiOutput::RestApiOutput(HttpOutput& output, | 44 RestApiOutput::RestApiOutput(HttpOutput& output, |
45 HttpMethod method) : | 45 HttpMethod method) : |
46 output_(output), | 46 output_(output), |
47 method_(method), | 47 method_(method), |
48 allowDeflateCompression_(false), | |
49 allowGzipCompression_(false), | |
50 convertJsonToXml_(false) | 48 convertJsonToXml_(false) |
51 { | 49 { |
52 alreadySent_ = false; | 50 alreadySent_ = false; |
53 } | 51 } |
54 | 52 |
74 void RestApiOutput::CheckStatus() | 72 void RestApiOutput::CheckStatus() |
75 { | 73 { |
76 if (alreadySent_) | 74 if (alreadySent_) |
77 { | 75 { |
78 throw OrthancException(ErrorCode_BadSequenceOfCalls); | 76 throw OrthancException(ErrorCode_BadSequenceOfCalls); |
79 } | |
80 } | |
81 | |
82 | |
83 HttpCompression RestApiOutput::GetPreferredCompression(size_t bodySize) const | |
84 { | |
85 #if 0 | |
86 // TODO | |
87 if (bodySize < 1024) | |
88 { | |
89 // Do not compress small answers | |
90 return HttpCompression_None; | |
91 } | |
92 #endif | |
93 | |
94 if (allowGzipCompression_) | |
95 { | |
96 return HttpCompression_Gzip; | |
97 } | |
98 else if (allowDeflateCompression_) | |
99 { | |
100 return HttpCompression_Deflate; | |
101 } | |
102 else | |
103 { | |
104 return HttpCompression_None; | |
105 } | 77 } |
106 } | 78 } |
107 | 79 |
108 | 80 |
109 void RestApiOutput::AnswerFile(HttpFileSender& sender) | 81 void RestApiOutput::AnswerFile(HttpFileSender& sender) |