in dicom_util/src/main/java/com/google/cloud/healthcare/DicomWebClient.java [101:124]
public JSONArray qidoRs(String path) throws IDicomWebClient.DicomWebException {
try {
HttpRequest httpRequest =
requestFactory.buildGetRequest(
new GenericUrl(serviceUrlPrefix + "/" + StringUtil.trim(path)));
HttpResponse httpResponse = httpRequest.execute();
// dcm4che server can return 204 responses.
if (httpResponse.getStatusCode() == HttpStatusCodes.STATUS_CODE_NO_CONTENT) {
return new JSONArray();
}
return new JSONArray(
CharStreams.toString(
new InputStreamReader(httpResponse.getContent(), StandardCharsets.UTF_8)));
} catch (HttpResponseException e) {
throw new DicomWebException(
String.format("QidoRs: %d, %s", e.getStatusCode(), e.getStatusMessage()),
e,
e.getStatusCode(),
Status.UnableToCalculateNumberOfMatches);
} catch (IOException | IllegalArgumentException e) {
throw new IDicomWebClient.DicomWebException(e);
}
}