comparison OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp @ 4819:70d2a97ca8cb openssl-3.x

integration mainline->openssl-3.x
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 25 Nov 2021 13:12:32 +0100
parents 61da49321754 7afbb54bd028
children 2e71a08eea15
comparison
equal deleted inserted replaced
4785:61da49321754 4819:70d2a97ca8cb
741 741
742 call.GetDocumentation() 742 call.GetDocumentation()
743 .SetTag("Instances") 743 .SetTag("Instances")
744 .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest") 744 .SetUriArgument("id", "Orthanc identifier of the DICOM instance of interest")
745 .SetHttpGetArgument("quality", RestApiCallDocumentation::Type_Number, "Quality for JPEG images (between 1 and 100, defaults to 90)", false) 745 .SetHttpGetArgument("quality", RestApiCallDocumentation::Type_Number, "Quality for JPEG images (between 1 and 100, defaults to 90)", false)
746 .SetHttpGetArgument("returnUnsupportedImage", RestApiCallDocumentation::Type_Boolean, "Returns an unsupported.png placeholder image if unable to provide the image instead of returning a 415 HTTP error (defaults to false)", false)
746 .SetHttpHeader("Accept", "Format of the resulting image. Can be `image/png` (default), `image/jpeg` or `image/x-portable-arbitrarymap`") 747 .SetHttpHeader("Accept", "Format of the resulting image. Can be `image/png` (default), `image/jpeg` or `image/x-portable-arbitrarymap`")
747 .AddAnswerType(MimeType_Png, "PNG image") 748 .AddAnswerType(MimeType_Png, "PNG image")
748 .AddAnswerType(MimeType_Jpeg, "JPEG image") 749 .AddAnswerType(MimeType_Jpeg, "JPEG image")
749 .AddAnswerType(MimeType_Pam, "PAM image (Portable Arbitrary Map)") 750 .AddAnswerType(MimeType_Pam, "PAM image (Portable Arbitrary Map)")
750 .SetDescription(description); 751 .SetDescription(description);
803 // The frame number is out of the range for this DICOM 804 // The frame number is out of the range for this DICOM
804 // instance, the resource is not existent 805 // instance, the resource is not existent
805 } 806 }
806 else 807 else
807 { 808 {
808 std::string root = ""; 809 if (call.HasArgument("returnUnsupportedImage"))
809 for (size_t i = 1; i < call.GetFullUri().size(); i++)
810 { 810 {
811 root += "../"; 811 std::string root = "";
812 for (size_t i = 1; i < call.GetFullUri().size(); i++)
813 {
814 root += "../";
815 }
816
817 call.GetOutput().Redirect(root + "app/images/unsupported.png");
812 } 818 }
813 819 else
814 call.GetOutput().Redirect(root + "app/images/unsupported.png"); 820 {
821 call.GetOutput().SignalError(HttpStatus_415_UnsupportedMediaType);
822 }
815 } 823 }
816 return; 824 return;
817 } 825 }
818 826
819 } 827 }
2955 ServerContext& context = OrthancRestApi::GetContext(call); 2963 ServerContext& context = OrthancRestApi::GetContext(call);
2956 2964
2957 std::string publicId = call.GetUriComponent("id", ""); 2965 std::string publicId = call.GetUriComponent("id", "");
2958 2966
2959 std::string dicomContent; 2967 std::string dicomContent;
2960 context.ReadDicom(dicomContent, publicId); 2968 context.ReadDicomForHeader(dicomContent, publicId);
2961 2969
2962 // TODO Consider using "DicomMap::ParseDicomMetaInformation()" to 2970 // TODO Consider using "DicomMap::ParseDicomMetaInformation()" to
2963 // speed up things here 2971 // speed up things here
2964 2972
2965 ParsedDicomFile dicom(dicomContent); 2973 ParsedDicomFile dicom(dicomContent);