Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mode to web access #1804

Merged
merged 53 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
435dbbe
WIP start moving FhirRequestBuilder to ManagedWebAccess
dotasek Oct 21, 2024
ac6ef81
Merge remote-tracking branch 'origin/master' into do-20241021-tx-auth
dotasek Oct 21, 2024
f9ce823
Update PECodeGenerator.java
jkiddo Oct 22, 2024
12ee505
Merge pull request #1786 from jkiddo/patch-4
grahamegrieve Oct 22, 2024
a94e1bc
WIP keep moving FhirRequestBuilder to ManagedWebAccess + fix some tests
dotasek Oct 22, 2024
fa19dc4
Merge remote-tracking branch 'origin/2024-10-gg-tx-server-auth' into …
dotasek Oct 22, 2024
fdbf0da
WIP move logging, retry, timeout and proxy
dotasek Oct 23, 2024
ddb0a66
Merge branch '2024-10-gg-tx-server-auth-1' into do-20241021-tx-auth
dotasek Oct 23, 2024
b33de12
WIP move accept to parameter
dotasek Oct 24, 2024
0b45b0b
WIP some HTTP Header refactoring, rename FhirRequest to HTTPRequest
dotasek Oct 25, 2024
03b0c16
Merge branch 'master' into do-20241021-tx-auth
dotasek Oct 25, 2024
0308d18
WIP fix removed import
dotasek Oct 25, 2024
f82f876
Tidy up code
dotasek Oct 25, 2024
b51ac15
Fix for renamed class
dotasek Oct 28, 2024
555edcf
Change mem settings for build
dotasek Oct 28, 2024
2de5c65
Merge remote-tracking branch 'origin/master' into do-20241021-tx-auth
dotasek Oct 28, 2024
cbafe2a
Adjust pipeline mem again
dotasek Oct 28, 2024
d8ca1cc
Apply changes to r4b
dotasek Oct 29, 2024
fe58a8a
Actually add headers from HTTPRequest to OkHttp request
dotasek Oct 29, 2024
a5ef974
Use ManagedFhirWebAccess in r4
dotasek Oct 29, 2024
2fdfaf8
Removing leftover okttp usage
dotasek Oct 29, 2024
2f95e3f
Remove unused classes and okhttp usages and add tests for r4
dotasek Oct 30, 2024
eb71440
Make dstu3 use ManagedFhirWebAccess
dotasek Oct 30, 2024
c5aaf43
Make sure we get response headers
dotasek Oct 30, 2024
a76078a
Add test coverage (some failing) for DSTU2 ClientUtils
dotasek Nov 1, 2024
bdc02a5
Merge remote-tracking branch 'origin/master' into do-20241021-tx-auth
dotasek Nov 1, 2024
11a11da
Add FHIRToolingClient tests
dotasek Nov 1, 2024
ac7c733
Use ManagedFhirWebAccess for DSTU2
dotasek Nov 4, 2024
f1d5f71
WIP restore format header tests - turns out they break
dotasek Nov 5, 2024
07b31d9
Fix format header issues
dotasek Nov 5, 2024
e45c0b2
Merge remote-tracking branch 'origin/master' into do-20241021-tx-auth
dotasek Nov 5, 2024
b6ef81c
Switch to static fhirBuilder for all FhirRequestBuilders
dotasek Nov 6, 2024
afd9e7a
Merge remote-tracking branch 'origin/master' into do-20241021-tx-auth
dotasek Nov 7, 2024
0c4da02
fix slicing by type and profile to allow multiple options per slice
Nov 7, 2024
ee7dc20
List measure choices when a match by version can't be found
Nov 7, 2024
a93ab69
Validate fhirpath expression in slice discriminators
Nov 7, 2024
2c57f59
Remove conflicting authorization header setting methods
dotasek Nov 7, 2024
7aef291
fix VSAC importer for changes to ManagedWebAccess
Nov 7, 2024
d98e575
Merge remote-tracking branch 'origin/do-20241021-tx-auth' into do-202…
Nov 7, 2024
4592dc1
Tests 1
dotasek Nov 7, 2024
e9917de
Rename ...AccessBuilder classes to ...Accessor
dotasek Nov 7, 2024
822f086
Fix api-key token mixup, more tests
dotasek Nov 7, 2024
2bbfcb8
Resolve all deletions enclosed in FIXME + fix headers in dstu2 postfeed
dotasek Nov 8, 2024
ebcbf4d
More TODO erasures. Plus found missing functionality
dotasek Nov 8, 2024
cc00bb9
Move tests to utilities. Clarify missing functionality
dotasek Nov 8, 2024
fb6a22c
Clean up comments and JavaDoc
dotasek Nov 8, 2024
d724a27
Final rename
dotasek Nov 8, 2024
8b43a95
update vsac access code
Nov 8, 2024
765ba8b
Fix get bytes for -1 or chunked content
dotasek Nov 8, 2024
60acdd0
Add mode to web access
Nov 9, 2024
4c5c714
Merge branch 'master' into 2024-11-gg-web-mode2
dotasek Nov 9, 2024
cac080b
Fix merge issue.
dotasek Nov 11, 2024
4ee4a89
Fix refactor misses
dotasek Nov 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private void processCurrentPackage(String url, String pid, Set<String> cpidSet,
File co = ManagedFileAccess.file(Utilities.path(cache, pid+"."+manifest.asString("date")+".tgz"));
if (!co.exists()) {

HTTPResult res = ManagedWebAccess.get(repo+"/package.tgz?nocache=" + System.currentTimeMillis());
HTTPResult res = ManagedWebAccess.get("web", repo+"/package.tgz?nocache=" + System.currentTimeMillis());
res.checkThrowException();
TextFile.bytesToFile(res.getContent(), co);
}
Expand Down Expand Up @@ -338,7 +338,7 @@ private void processFeed(Set<String> list, String str) throws IOException, Parse
System.out.println("Feed "+str);
try {

HTTPResult res = ManagedWebAccess.get(str+"?nocache=" + System.currentTimeMillis());
HTTPResult res = ManagedWebAccess.get("web", str+"?nocache=" + System.currentTimeMillis());
res.checkThrowException();
Document xml = XMLUtil.parseToDom(res.getContent());
for (Element channel : XMLUtil.getNamedChildren(xml.getDocumentElement(), "channel")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ private CodeSystem makeEntityCodeSystem() {


private JsonObject fetchJson(String source) throws IOException {
HTTPResult res = ManagedWebAccess.accessor().withHeader("API-Version", "v2").withHeader("Accept-Language", "en").get(source,"application/json");
HTTPResult res = ManagedWebAccess.accessor("web").withHeader("API-Version", "v2").withHeader("Accept-Language", "en").get(source,"application/json");
res.checkThrowException();
return JsonParser.parseObject(res.getContent());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1384,7 +1384,7 @@ private String cachedFetch(String id, String source) throws IOException {
if (f.exists())
return TextFile.fileToString(f);

HTTPResult res = ManagedWebAccess.get(source);
HTTPResult res = ManagedWebAccess.get("web", source);
res.checkThrowException();
String result = TextFile.bytesToString(res.getContent());
TextFile.stringToFile(result, f);
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void fillCache(String source) throws IOException {
try {
System.out.println("Initialise terminology cache from " + source);

HTTPResult res = ManagedWebAccess.get(source + "?nocache=" + System.currentTimeMillis());
HTTPResult res = ManagedWebAccess.get("web", source + "?nocache=" + System.currentTimeMillis());
res.checkThrowException();
unzip(new ByteArrayInputStream(res.getContent()), cacheFolder);
} catch (Exception e) {
Expand Down Expand Up @@ -148,7 +148,7 @@ public void commit(String token) throws IOException {
String url = "https://tx.fhir.org/post/tx-cache/" + ghOrg + "/" + ghRepo + "/" + ghBranch + ".zip";
System.out.println("Sending tx-cache to " + url + " (" + Utilities.describeSize(bs.toByteArray().length) + ")");

HTTPResult res = ManagedWebAccess.accessor()
HTTPResult res = ManagedWebAccess.accessor("web")
.withBasicAuth(token.substring(0, token.indexOf(':')), token.substring(token.indexOf(':') + 1))
.put(url, bs.toByteArray(), null, "application/zip");
if (res.getCode() >= 300) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -428,6 +431,20 @@ private static String decompress(byte[] compressed) throws Exception {
private String getVCIIssuer(List<ValidationMessage> 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ private ValidatedFragment addNamedElement(List<ValidatedFragment> 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;
}
Expand All @@ -299,7 +299,7 @@ private HTTPResult fetchManifest() throws IOException {

JsonObject j = new JsonObject();
j.add("recipient", "FHIR Validator");
HTTPResult res = ManagedWebAccess.post(url, org.hl7.fhir.utilities.json.parser.JsonParser.composeBytes(j), "application/json", "application/json");
HTTPResult res = ManagedWebAccess.post("web", url, org.hl7.fhir.utilities.json.parser.JsonParser.composeBytes(j), "application/json", "application/json");
res.checkThrowException();
return res;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private void fillCache(String source) throws IOException {
try {
System.out.println("Initialise terminology cache from "+source);

HTTPResult res = ManagedWebAccess.get(source+"?nocache=" + System.currentTimeMillis());
HTTPResult res = ManagedWebAccess.get("web", source+"?nocache=" + System.currentTimeMillis());
res.checkThrowException();
unzip(new ByteArrayInputStream(res.getContent()), cacheFolder);
} catch (Exception e) {
Expand Down Expand Up @@ -148,7 +148,7 @@ public void commit(String token) throws IOException {
// post it to
String url = "https://tx.fhir.org/post/tx-cache/"+ghOrg+"/"+ghRepo+"/"+ghBranch+".zip";
System.out.println("Sending tx-cache to "+url+" ("+Utilities.describeSize(bs.toByteArray().length)+")");
HTTPResult res = ManagedWebAccess.accessor()
HTTPResult res = ManagedWebAccess.accessor("web")
.withBasicAuth(token.substring(0, token.indexOf(':')), token.substring(token.indexOf(':') + 1))
.put(url, bs.toByteArray(), null, "application/zip");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public ManagedFhirWebAccessor withLogger(ToolingClientLogger logger) {


public ManagedFhirWebAccessor(String userAgent, List<ServerDetailsPOJO> serverAuthDetails) {
super(userAgent, serverAuthDetails);
super("fhir", userAgent, serverAuthDetails);
this.timeout = 5000;
this.timeoutUnit = TimeUnit.MILLISECONDS;
}
Expand Down Expand Up @@ -88,7 +88,7 @@ protected HTTPRequest requestWithManagedHeaders(HTTPRequest httpRequest) {
}
}
} else {
ServerDetailsPOJO settings = ManagedWebAccessUtils.getServer(httpRequest.getUrl().toString(), getServerAuthDetails());
ServerDetailsPOJO settings = ManagedWebAccessUtils.getServer(getMode(), httpRequest.getUrl().toString(), getServerAuthDetails());
if (settings != null) {
switch (settings.getAuthenticationType()) {
case "basic":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
public class ManagedWebAccess {

public interface IWebAccessor {
HTTPResult get(String url, String accept, Map<String, String> headers) throws IOException;
HTTPResult post(String url, byte[] bytes, String contentType, String accept, Map<String, String> headers) throws IOException;
HTTPResult put(String url, byte[] bytes, String contentType, String accept, Map<String, String> headers) throws IOException;
HTTPResult get(String mode, String url, String accept, Map<String, String> headers) throws IOException;
HTTPResult post(String mode, String url, byte[] bytes, String contentType, String accept, Map<String, String> headers) throws IOException;
HTTPResult put(String mode, String url, byte[] bytes, String contentType, String accept, Map<String, String> headers) throws IOException;
}

public interface IFhirWebAccessor {
Expand Down Expand Up @@ -104,28 +104,28 @@ public static void setUserAgent(String userAgent) {
ManagedWebAccess.userAgent = userAgent;
}

public static ManagedWebAccessor accessor() {
return new ManagedWebAccessor(userAgent, serverAuthDetails);
public static ManagedWebAccessor accessor(String mode) {
return new ManagedWebAccessor(mode, userAgent, serverAuthDetails);
}

public static ManagedFhirWebAccessor fhirAccessor() {
return new ManagedFhirWebAccessor(userAgent, serverAuthDetails);
}

public static HTTPResult get(String url) throws IOException {
return accessor().get(url);
public static HTTPResult get(String mode, String url) throws IOException {
return accessor(mode).get(url);
}

public static HTTPResult get(String url, String accept) throws IOException {
return accessor().get(url, accept);
public static HTTPResult get(String mode, String url, String accept) throws IOException {
return accessor(mode).get(url, accept);
}

public static HTTPResult post(String url, byte[] content, String contentType, String accept) throws IOException {
return accessor().post(url, content, contentType, accept);
public static HTTPResult post(String mode, String url, byte[] content, String contentType, String accept) throws IOException {
return accessor(mode).post(url, content, contentType, accept);
}

public static HTTPResult put(String url, byte[] content, String contentType, String accept) throws IOException {
return accessor().put(url, content, contentType, accept);
public static HTTPResult put(String mode, String url, byte[] content, String contentType, String accept) throws IOException {
return accessor(mode).put(url, content, contentType, accept);
}

public static HTTPResult httpCall(HTTPRequest httpRequest) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@

public class ManagedWebAccessUtils {

public static ServerDetailsPOJO getServer(String url, Iterable<ServerDetailsPOJO> serverAuthDetails) {
public static ServerDetailsPOJO getServer(String mode, String url, Iterable<ServerDetailsPOJO> serverAuthDetails) {
if (serverAuthDetails != null) {
for (ServerDetailsPOJO t : serverAuthDetails) {
if (url.startsWith(t.getUrl())) {
if (url.startsWith(t.getUrl()) && modesMatch(mode, t.getMode())) {
return t;
}
}
}
return null;
}

private static boolean modesMatch(String criteria, String value) {
return criteria == null || value == null || criteria.equals(value);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
*/
public class ManagedWebAccessor extends ManagedWebAccessorBase<ManagedWebAccessor> {

public ManagedWebAccessor(String userAgent, List<ServerDetailsPOJO> serverAuthDetails) {
super(userAgent, serverAuthDetails);
public ManagedWebAccessor(String mode, String userAgent, List<ServerDetailsPOJO> serverAuthDetails) {
super(mode, userAgent, serverAuthDetails);
}

private Map<String, String> newHeaders() {
Expand Down Expand Up @@ -66,7 +66,7 @@ private SimpleHTTPClient setupClient(String url) throws IOException {
}
}
} else {
ServerDetailsPOJO settings = ManagedWebAccessUtils.getServer(url, getServerAuthDetails());
ServerDetailsPOJO settings = ManagedWebAccessUtils.getServer(getMode(), url, getServerAuthDetails());
if (settings != null) {
switch (settings.getAuthenticationType()) {
case "basic" :
Expand Down Expand Up @@ -101,7 +101,7 @@ public HTTPResult get(String url, String accept) throws IOException {
SimpleHTTPClient client = setupClient(url);
return client.get(url, accept);
case MANAGED:
return ManagedWebAccess.getAccessor().get(url, accept, newHeaders());
return ManagedWebAccess.getAccessor().get(getMode(), url, accept, newHeaders());
case PROHIBITED:
throw new IOException("Access to the internet is not allowed by local security policy");
default:
Expand All @@ -119,7 +119,7 @@ public HTTPResult post(String url, byte[] content, String contentType, String ac
SimpleHTTPClient client = setupClient(url);
return client.post(url, contentType, content, accept);
case MANAGED:
return ManagedWebAccess.getAccessor().post(url, content, contentType, accept, newHeaders());
return ManagedWebAccess.getAccessor().post(getMode(), url, content, contentType, accept, newHeaders());
case PROHIBITED:
throw new IOException("Access to the internet is not allowed by local security policy");
default:
Expand All @@ -137,7 +137,7 @@ public HTTPResult put(String url, byte[] content, String contentType, String acc
SimpleHTTPClient client = setupClient(url);
return client.put(url, contentType, content, accept);
case MANAGED:
return ManagedWebAccess.getAccessor().put(url, content, contentType, accept, newHeaders());
return ManagedWebAccess.getAccessor().put(getMode(), url, content, contentType, accept, newHeaders());
case PROHIBITED:
throw new IOException("Access to the internet is not allowed by local security policy");
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import java.util.Map;

public abstract class ManagedWebAccessorBase<B extends ManagedWebAccessorBase<B>> {
@Getter
private final String mode;

@Getter
private final String userAgent;
@Getter
Expand All @@ -24,7 +27,8 @@ public abstract class ManagedWebAccessorBase<B extends ManagedWebAccessorBase<B>
@Getter
private final Map<String, String> headers = new HashMap<>();

public ManagedWebAccessorBase(String userAgent, List<ServerDetailsPOJO> serverAuthDetails) {
public ManagedWebAccessorBase(String mode, String userAgent, List<ServerDetailsPOJO> serverAuthDetails) {
this.mode = mode;
this.userAgent = userAgent;
this.serverAuthDetails = serverAuthDetails;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

*/



Expand Down Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Loading
Loading