diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/CKMImporter.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/CKMImporter.java index e4d04ada77..e6581f81e4 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/CKMImporter.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/misc/CKMImporter.java @@ -126,7 +126,7 @@ private void processArchetype(String id) throws Exception { private Document loadXml(String address) throws Exception { - HTTPResult res = ManagedWebAccess.get(address, "application/xml"); + HTTPResult res = ManagedWebAccess.get("web", address, "application/xml"); res.checkThrowException(); InputStream xml = new ByteArrayInputStream(res.getContent()); diff --git a/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/VSACClientTest.java b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/VSACClientTest.java new file mode 100644 index 0000000000..97937fa23a --- /dev/null +++ b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/VSACClientTest.java @@ -0,0 +1,18 @@ +package org.hl7.fhir.r4.test; + +import org.hl7.fhir.r4.model.CapabilityStatement; +import org.hl7.fhir.r4.utils.client.FHIRToolingClient; +import org.junit.jupiter.api.Test; + +import java.net.URISyntaxException; + +public class VSACClientTest { + @Test + public void testVSAC() throws URISyntaxException { + FHIRToolingClient fhirToolingClient = new FHIRToolingClient("https://cts.nlm.nih.gov/fhir", "fhir/vsac"); + fhirToolingClient.setTimeoutNormal(30000); + fhirToolingClient.setTimeoutExpand(30000); + CapabilityStatement cs = fhirToolingClient.getCapabilitiesStatement(); + System.out.println(cs); + } +} diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHCParser.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHCParser.java index 1376bdcb6d..04d936f989 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHCParser.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHCParser.java @@ -29,6 +29,9 @@ import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.VersionUtilities; +import org.hl7.fhir.utilities.http.HTTPRequest; +import org.hl7.fhir.utilities.http.HTTPResult; +import org.hl7.fhir.utilities.http.ManagedWebAccess; import org.hl7.fhir.utilities.json.JsonException; import org.hl7.fhir.utilities.json.model.JsonArray; import org.hl7.fhir.utilities.json.model.JsonElement; @@ -428,6 +431,20 @@ private static String decompress(byte[] compressed) throws Exception { private String getVCIIssuer(List errors, String issuer) { try { JsonObject vci = org.hl7.fhir.utilities.json.parser.JsonParser.parseObjectFromUrl("https://raw.githubusercontent.com/the-commons-project/vci-directory/main/vci-issuers.json"); + + /* HTTPResult httpResult = ManagedWebAccess.httpCall( + new HTTPRequest().withMethod(HTTPVerb.GET).withUrl(new URL("https://raw.githubusercontent.com/the-commons-project/vci-directory/main/vci-issuers.json")) + new URL("https://raw.githubusercontent.com/the-commons-project/vci-directory/main/vci-issuers.json") + HTTPRequest.HttpMethod.GET, + null, + null, + null + + ) + ) + */ + + //JsonObject vci = org.hl7.fhir.utilities.json.parser.JsonParser.parseObject(); for (JsonObject j : vci.getJsonObjects("participating_issuers")) { if (issuer.equals(j.asString("iss"))) { return j.asString("name"); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHLParser.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHLParser.java index 71297b9fe6..ffdd2560ac 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHLParser.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/SHLParser.java @@ -287,7 +287,7 @@ private ValidatedFragment addNamedElement(List res, String na private HTTPResult fetchFile(String url, String ct) throws IOException { - HTTPResult res = ManagedWebAccess.get(url, ct); + HTTPResult res = ManagedWebAccess.get("web", url, ct); res.checkThrowException(); return res; } diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonTrackingParser.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonTrackingParser.java index 893aba96c3..f787357e89 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonTrackingParser.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonTrackingParser.java @@ -2,34 +2,34 @@ import java.io.File; -/* - Copyright (c) 2011+, HL7, Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of HL7 nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - - */ +/* + Copyright (c) 2011+, HL7, Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + */ @@ -724,13 +724,13 @@ public static byte[] writeBytes(JsonObject json, boolean pretty) { } public static JsonObject fetchJson(String source) throws IOException { - HTTPResult res = ManagedWebAccess.get(source+"?nocache=" + System.currentTimeMillis(), "application/json, application/fhir+json"); + HTTPResult res = ManagedWebAccess.get("web", source+"?nocache=" + System.currentTimeMillis(), "application/json, application/fhir+json"); res.checkThrowException(); return parseJson(res.getContent()); } public static JsonArray fetchJsonArray(String source) throws IOException { - HTTPResult res = ManagedWebAccess.get(source+"?nocache=" + System.currentTimeMillis(), "application/json, application/fhir+json"); + HTTPResult res = ManagedWebAccess.get("web",source+"?nocache=" + System.currentTimeMillis(), "application/json, application/fhir+json"); res.checkThrowException(); return parseJsonArray(res.getContent()); } diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/parser/JsonParser.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/parser/JsonParser.java index df6efedc35..c1e8e61044 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/parser/JsonParser.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/parser/JsonParser.java @@ -692,7 +692,7 @@ private void write(StringBuilder b, JsonElement e, boolean pretty, int indent) { private static byte[] fetch(String source) throws IOException { String murl = source.contains("?") ? source+"&nocache=" + System.currentTimeMillis() : source+"?nocache=" + System.currentTimeMillis(); - HTTPResult res = ManagedWebAccess.get(murl, "application/json, application/fhir+json"); + HTTPResult res = ManagedWebAccess.get("web", murl, "application/json, application/fhir+json"); res.checkThrowException(); return res.getContent(); } diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java index 1462a83680..c6d4ef8e63 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/IgLoader.java @@ -584,11 +584,11 @@ private byte[] fetchFromUrlSpecific(String source, String contentType, boolean o try { try { // try with cache-busting option and then try withhout in case the server doesn't support that - HTTPResult res = ManagedWebAccess.get(source + "?nocache=" + System.currentTimeMillis(), contentType); + HTTPResult res = ManagedWebAccess.get("web",source + "?nocache=" + System.currentTimeMillis(), contentType); res.checkThrowException(); return res.getContent(); } catch (Exception e) { - HTTPResult res = ManagedWebAccess.get(source, contentType); + HTTPResult res = ManagedWebAccess.get("web", source, contentType); res.checkThrowException(); return res.getContent(); } diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ipa/IPAValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ipa/IPAValidator.java index 327567cc02..b0793fafa1 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ipa/IPAValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ipa/IPAValidator.java @@ -160,7 +160,7 @@ private void checkSelfLink(ValidationNode vn, Element bundle, Map= 300) { vn.getIssues().add(new ValidationMessage(Source.IPAValidator, IssueType.EXCEPTION, "http.request", "HTTP Return code is "+result.getCode()+" "+result.getMessage(),