comparison OrthancServer/ServerContext.cpp @ 1523:c388502a066d

testing FilesystemHttpSender
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 11 Aug 2015 16:09:00 +0200
parents f938f7779bcb
children f9b0169eb6bb
comparison
equal deleted inserted replaced
1522:f938f7779bcb 1523:c388502a066d
311 if (!index_.LookupAttachment(attachment, instancePublicId, content)) 311 if (!index_.LookupAttachment(attachment, instancePublicId, content))
312 { 312 {
313 throw OrthancException(ErrorCode_InternalError); 313 throw OrthancException(ErrorCode_InternalError);
314 } 314 }
315 315
316 #if 1
316 accessor_.SetCompressionForNextOperations(attachment.GetCompressionType()); 317 accessor_.SetCompressionForNextOperations(attachment.GetCompressionType());
317 318
318 std::auto_ptr<HttpFileSender> sender(accessor_.ConstructHttpFileSender(attachment.GetUuid(), attachment.GetContentType())); 319 std::auto_ptr<HttpFileSender> sender(accessor_.ConstructHttpFileSender(attachment.GetUuid(), attachment.GetContentType()));
319 sender->SetContentType(GetMimeType(content)); 320 sender->SetContentType(GetMimeType(content));
320 sender->SetContentFilename(instancePublicId + ".dcm"); 321 sender->SetContentFilename(instancePublicId + ".dcm"); // TODO ".dcm" => ToMimeType(content)
321 output.AnswerStream(*sender); 322 output.AnswerStream(*sender);
323 #else
324 const FilesystemStorage& a = dynamic_cast<FilesystemStorage&>(accessor_.GetStorageArea());
325
326 FilesystemHttpSender sender(a, attachment.GetUuid());
327 sender.SetSourceCompression(attachment.GetCompressionType());
328 sender.SetContentType(GetMimeType(content));
329 sender.SetContentFilename(instancePublicId + ".dcm");
330 output.AnswerStream(sender);
331 #endif
322 } 332 }
323 333
324 334
325 void ServerContext::ReadJson(Json::Value& result, 335 void ServerContext::ReadJson(Json::Value& result,
326 const std::string& instancePublicId) 336 const std::string& instancePublicId)