@Test public void testDicomWebClient_NothingInjected() throws Exception { assertThrows(IDicomWebClient.DicomWebException.class, () -> client.qidoRs("query")); }
public JSONArray qidoRs(String path) throws IDicomWebClient.DicomWebException { try { HttpRequest httpRequest = requestFactory.buildGetRequest(new GenericUrl(serviceUrlPrefix + "/" + StringUtil.trim(path))); HttpResponse httpResponse = httpRequest.execute(); 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); } }
DicomWebClient implements IDicomWebClient { public JSONArray qidoRs(String path) throws IDicomWebClient.DicomWebException { try { HttpRequest httpRequest = requestFactory.buildGetRequest(new GenericUrl(serviceUrlPrefix + "/" + StringUtil.trim(path))); HttpResponse httpResponse = httpRequest.execute(); 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); } } }
DicomWebClient implements IDicomWebClient { public JSONArray qidoRs(String path) throws IDicomWebClient.DicomWebException { try { HttpRequest httpRequest = requestFactory.buildGetRequest(new GenericUrl(serviceUrlPrefix + "/" + StringUtil.trim(path))); HttpResponse httpResponse = httpRequest.execute(); 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); } } @Inject  DicomWebClient(
      HttpRequestFactory requestFactory,
      @Annotations.DicomwebAddr String serviceUrlPrefix,
      String stowPath); }
DicomWebClient implements IDicomWebClient { public JSONArray qidoRs(String path) throws IDicomWebClient.DicomWebException { try { HttpRequest httpRequest = requestFactory.buildGetRequest(new GenericUrl(serviceUrlPrefix + "/" + StringUtil.trim(path))); HttpResponse httpResponse = httpRequest.execute(); 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); } } @Inject  DicomWebClient(
      HttpRequestFactory requestFactory,
      @Annotations.DicomwebAddr String serviceUrlPrefix,
      String stowPath); InputStream wadoRs(String path); JSONArray qidoRs(String path); void stowRs(InputStream in); }
DicomWebClient implements IDicomWebClient { public JSONArray qidoRs(String path) throws IDicomWebClient.DicomWebException { try { HttpRequest httpRequest = requestFactory.buildGetRequest(new GenericUrl(serviceUrlPrefix + "/" + StringUtil.trim(path))); HttpResponse httpResponse = httpRequest.execute(); 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); } } @Inject  DicomWebClient(
      HttpRequestFactory requestFactory,
      @Annotations.DicomwebAddr String serviceUrlPrefix,
      String stowPath); InputStream wadoRs(String path); JSONArray qidoRs(String path); void stowRs(InputStream in);  }