@Test public void testDicomWebClient_WadoError() throws Exception { fakeDicomWebServer.addResponseWithStatusCode(404); assertThrows(IDicomWebClient.DicomWebException.class, () -> client.wadoRs("instanceName")); }
public InputStream wadoRs(String path) throws IDicomWebClient.DicomWebException { try { HttpRequest httpRequest = requestFactory.buildGetRequest(new GenericUrl(serviceUrlPrefix + "/" + StringUtil.trim(path))); httpRequest.getHeaders().put("Accept", "application/dicom; transfer-syntax=*"); HttpResponse httpResponse = httpRequest.execute(); return httpResponse.getContent(); } catch (HttpResponseException e) { throw new DicomWebException( String.format("WadoRs: %d, %s", e.getStatusCode(), e.getStatusMessage()), e, e.getStatusCode(), Status.ProcessingFailure); } catch (IOException | IllegalArgumentException e) { throw new IDicomWebClient.DicomWebException(e); } }
DicomWebClient implements IDicomWebClient { public InputStream wadoRs(String path) throws IDicomWebClient.DicomWebException { try { HttpRequest httpRequest = requestFactory.buildGetRequest(new GenericUrl(serviceUrlPrefix + "/" + StringUtil.trim(path))); httpRequest.getHeaders().put("Accept", "application/dicom; transfer-syntax=*"); HttpResponse httpResponse = httpRequest.execute(); return httpResponse.getContent(); } catch (HttpResponseException e) { throw new DicomWebException( String.format("WadoRs: %d, %s", e.getStatusCode(), e.getStatusMessage()), e, e.getStatusCode(), Status.ProcessingFailure); } catch (IOException | IllegalArgumentException e) { throw new IDicomWebClient.DicomWebException(e); } } }
DicomWebClient implements IDicomWebClient { public InputStream wadoRs(String path) throws IDicomWebClient.DicomWebException { try { HttpRequest httpRequest = requestFactory.buildGetRequest(new GenericUrl(serviceUrlPrefix + "/" + StringUtil.trim(path))); httpRequest.getHeaders().put("Accept", "application/dicom; transfer-syntax=*"); HttpResponse httpResponse = httpRequest.execute(); return httpResponse.getContent(); } catch (HttpResponseException e) { throw new DicomWebException( String.format("WadoRs: %d, %s", e.getStatusCode(), e.getStatusMessage()), e, e.getStatusCode(), Status.ProcessingFailure); } catch (IOException | IllegalArgumentException e) { throw new IDicomWebClient.DicomWebException(e); } } @Inject  DicomWebClient(
      HttpRequestFactory requestFactory,
      @Annotations.DicomwebAddr String serviceUrlPrefix,
      String stowPath); }
DicomWebClient implements IDicomWebClient { public InputStream wadoRs(String path) throws IDicomWebClient.DicomWebException { try { HttpRequest httpRequest = requestFactory.buildGetRequest(new GenericUrl(serviceUrlPrefix + "/" + StringUtil.trim(path))); httpRequest.getHeaders().put("Accept", "application/dicom; transfer-syntax=*"); HttpResponse httpResponse = httpRequest.execute(); return httpResponse.getContent(); } catch (HttpResponseException e) { throw new DicomWebException( String.format("WadoRs: %d, %s", e.getStatusCode(), e.getStatusMessage()), e, e.getStatusCode(), Status.ProcessingFailure); } 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 InputStream wadoRs(String path) throws IDicomWebClient.DicomWebException { try { HttpRequest httpRequest = requestFactory.buildGetRequest(new GenericUrl(serviceUrlPrefix + "/" + StringUtil.trim(path))); httpRequest.getHeaders().put("Accept", "application/dicom; transfer-syntax=*"); HttpResponse httpResponse = httpRequest.execute(); return httpResponse.getContent(); } catch (HttpResponseException e) { throw new DicomWebException( String.format("WadoRs: %d, %s", e.getStatusCode(), e.getStatusMessage()), e, e.getStatusCode(), Status.ProcessingFailure); } 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);  }