comparison OrthancServer/ServerContext.cpp @ 1146:200fcac0deb4

optimization for access to attachments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Sep 2014 14:04:48 +0200
parents 0479d02c6778
children 0561f2087cc9
comparison
equal deleted inserted replaced
1145:0479d02c6778 1146:200fcac0deb4
389 } 389 }
390 } 390 }
391 391
392 392
393 393
394 void ServerContext::AnswerDicomFile(RestApiOutput& output, 394 void ServerContext::AnswerAttachment(RestApiOutput& output,
395 const std::string& instancePublicId, 395 const std::string& instancePublicId,
396 FileContentType content) 396 FileContentType content)
397 { 397 {
398 FileInfo attachment; 398 FileInfo attachment;
399 if (!index_.LookupAttachment(attachment, instancePublicId, content)) 399 if (!index_.LookupAttachment(attachment, instancePublicId, content))
400 { 400 {
401 throw OrthancException(ErrorCode_InternalError); 401 throw OrthancException(ErrorCode_InternalError);
402 } 402 }
403 403
404 accessor_.SetCompressionForNextOperations(attachment.GetCompressionType()); 404 accessor_.SetCompressionForNextOperations(attachment.GetCompressionType());
405 405
406 std::auto_ptr<HttpFileSender> sender(accessor_.ConstructHttpFileSender(attachment.GetUuid(), attachment.GetContentType())); 406 std::auto_ptr<HttpFileSender> sender(accessor_.ConstructHttpFileSender(attachment.GetUuid(), attachment.GetContentType()));
407 sender->SetContentType("application/dicom"); 407 sender->SetContentType(GetMimeType(content));
408 sender->SetDownloadFilename(instancePublicId + ".dcm"); 408 sender->SetDownloadFilename(instancePublicId + ".dcm");
409 output.AnswerFile(*sender); 409 output.AnswerFile(*sender);
410 } 410 }
411 411
412 412