comparison OrthancServer/OrthancRestApi/OrthancRestSystem.cpp @ 2908:9d277f8ad698

new enumeration: MimeType
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Oct 2018 16:16:07 +0100
parents ae20fccdd867
children 4767d36679ed
comparison
equal deleted inserted replaced
2907:0204af4ece6a 2908:9d277f8ad698
97 static void GenerateUid(RestApiGetCall& call) 97 static void GenerateUid(RestApiGetCall& call)
98 { 98 {
99 std::string level = call.GetArgument("level", ""); 99 std::string level = call.GetArgument("level", "");
100 if (level == "patient") 100 if (level == "patient")
101 { 101 {
102 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Patient), MIME_PLAIN_TEXT); 102 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Patient), MimeType_PlainText);
103 } 103 }
104 else if (level == "study") 104 else if (level == "study")
105 { 105 {
106 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Study), MIME_PLAIN_TEXT); 106 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Study), MimeType_PlainText);
107 } 107 }
108 else if (level == "series") 108 else if (level == "series")
109 { 109 {
110 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Series), MIME_PLAIN_TEXT); 110 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Series), MimeType_PlainText);
111 } 111 }
112 else if (level == "instance") 112 else if (level == "instance")
113 { 113 {
114 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Instance), MIME_PLAIN_TEXT); 114 call.GetOutput().AnswerBuffer(FromDcmtkBridge::GenerateUniqueIdentifier(ResourceType_Instance), MimeType_PlainText);
115 } 115 }
116 } 116 }
117 117
118 static void ExecuteScript(RestApiPostCall& call) 118 static void ExecuteScript(RestApiPostCall& call)
119 { 119 {
126 { 126 {
127 LuaScripting::Lock lock(context.GetLuaScripting()); 127 LuaScripting::Lock lock(context.GetLuaScripting());
128 lock.GetLua().Execute(result, command); 128 lock.GetLua().Execute(result, command);
129 } 129 }
130 130
131 call.GetOutput().AnswerBuffer(result, MIME_PLAIN_TEXT); 131 call.GetOutput().AnswerBuffer(result, MimeType_PlainText);
132 } 132 }
133 133
134 template <bool UTC> 134 template <bool UTC>
135 static void GetNowIsoString(RestApiGetCall& call) 135 static void GetNowIsoString(RestApiGetCall& call)
136 { 136 {
137 call.GetOutput().AnswerBuffer(SystemToolbox::GetNowIsoString(UTC), MIME_PLAIN_TEXT); 137 call.GetOutput().AnswerBuffer(SystemToolbox::GetNowIsoString(UTC), MimeType_PlainText);
138 } 138 }
139 139
140 140
141 static void GetDicomConformanceStatement(RestApiGetCall& call) 141 static void GetDicomConformanceStatement(RestApiGetCall& call)
142 { 142 {
143 std::string statement; 143 std::string statement;
144 GetFileResource(statement, EmbeddedResources::DICOM_CONFORMANCE_STATEMENT); 144 GetFileResource(statement, EmbeddedResources::DICOM_CONFORMANCE_STATEMENT);
145 call.GetOutput().AnswerBuffer(statement, MIME_PLAIN_TEXT); 145 call.GetOutput().AnswerBuffer(statement, MimeType_PlainText);
146 } 146 }
147 147
148 148
149 static void GetDefaultEncoding(RestApiGetCall& call) 149 static void GetDefaultEncoding(RestApiGetCall& call)
150 { 150 {
151 Encoding encoding = GetDefaultDicomEncoding(); 151 Encoding encoding = GetDefaultDicomEncoding();
152 call.GetOutput().AnswerBuffer(EnumerationToString(encoding), MIME_PLAIN_TEXT); 152 call.GetOutput().AnswerBuffer(EnumerationToString(encoding), MimeType_PlainText);
153 } 153 }
154 154
155 155
156 static void SetDefaultEncoding(RestApiPutCall& call) 156 static void SetDefaultEncoding(RestApiPutCall& call)
157 { 157 {
158 Encoding encoding = StringToEncoding(call.GetBodyData()); 158 Encoding encoding = StringToEncoding(call.GetBodyData());
159 159
160 Configuration::SetDefaultEncoding(encoding); 160 Configuration::SetDefaultEncoding(encoding);
161 161
162 call.GetOutput().AnswerBuffer(EnumerationToString(encoding), MIME_PLAIN_TEXT); 162 call.GetOutput().AnswerBuffer(EnumerationToString(encoding), MimeType_PlainText);
163 } 163 }
164 164
165 165
166 166
167 // Plugins information ------------------------------------------------------ 167 // Plugins information ------------------------------------------------------
263 } 263 }
264 } 264 }
265 #endif 265 #endif
266 } 266 }
267 267
268 call.GetOutput().AnswerBuffer(s, "application/javascript"); 268 call.GetOutput().AnswerBuffer(s, MimeType_JavaScript);
269 } 269 }
270 270
271 271
272 272
273 273
355 throw OrthancException(ErrorCode_InternalError); 355 throw OrthancException(ErrorCode_InternalError);
356 } 356 }
357 357
358 if (ok) 358 if (ok)
359 { 359 {
360 call.GetOutput().AnswerBuffer("{}", MIME_JSON); 360 call.GetOutput().AnswerBuffer("{}", MimeType_Json);
361 } 361 }
362 } 362 }
363 363
364 364
365 void OrthancRestApi::RegisterSystem() 365 void OrthancRestApi::RegisterSystem()