use of org.hl7.fhir.utilities.SimpleHTTPClient in project org.hl7.fhir.core by hapifhir.
the class ICD11Generator method fetchJson.
private JsonObject fetchJson(String source) throws IOException {
SimpleHTTPClient http = new SimpleHTTPClient();
http.addHeader("API-Version", "v2");
http.addHeader("Accept-Language", "en");
HTTPResult res = http.get(source, "application/json");
res.checkThrowException();
return JsonTrackingParser.parseJson(res.getContent());
}
use of org.hl7.fhir.utilities.SimpleHTTPClient in project org.hl7.fhir.core by hapifhir.
the class CKMImporter method loadXml.
private Document loadXml(String address) throws Exception {
SimpleHTTPClient http = new SimpleHTTPClient();
HTTPResult res = http.get(address, "application/xml");
res.checkThrowException();
InputStream xml = new ByteArrayInputStream(res.getContent());
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
return db.parse(xml);
}
use of org.hl7.fhir.utilities.SimpleHTTPClient in project org.hl7.fhir.core by hapifhir.
the class ValidationEngine method fetchRaw.
@Override
public byte[] fetchRaw(IResourceValidator validator, String source) throws IOException {
SimpleHTTPClient http = new SimpleHTTPClient();
HTTPResult res = http.get(source);
res.checkThrowException();
return res.getContent();
}
use of org.hl7.fhir.utilities.SimpleHTTPClient in project org.hl7.fhir.core by hapifhir.
the class ValidationEngine method handleOutput.
public void handleOutput(Resource r, String output, String version) throws FHIRException, IOException {
if (output.startsWith("http://")) {
ByteArrayOutputStream bs = new ByteArrayOutputStream();
handleOutputToStream(r, output, bs, version);
SimpleHTTPClient http = new SimpleHTTPClient();
HTTPResult res = http.post(output, "application/fhir+xml", bs.toByteArray(), "application/fhir+xml");
res.checkThrowException();
} else {
FileOutputStream s = new FileOutputStream(output);
handleOutputToStream(r, output, s, version);
}
}
use of org.hl7.fhir.utilities.SimpleHTTPClient in project org.hl7.fhir.core by hapifhir.
the class Scanner method download.
protected void download(String address, String filename) throws IOException {
SimpleHTTPClient http = new SimpleHTTPClient();
HTTPResult res = http.get(address);
res.checkThrowException();
TextFile.bytesToFile(res.getContent(), filename);
}
Aggregations