fix missing port from server when doing tx-registry redirections

This commit is contained in:
Grahame Grieve 2024-11-27 04:44:19 +00:00
parent 4be38a5e0c
commit 17b22424f6
1 changed files with 13 additions and 4 deletions

View File

@ -320,15 +320,24 @@ public class TerminologyClientManager {
serverList = decideWhichServer(s);
// testing support
try {
serverList.replace("tx.fhir.org", new URL(getMasterClient().getAddress()).getHost());
serverList.replace("tx.fhir.org", host());
} catch (MalformedURLException e) {
}
resMap.put(s, serverList);
// resMap.put(s, serverList);
save();
}
return serverList;
}
private String host() throws MalformedURLException {
URL url = new URL(getMasterClient().getAddress());
if (url.getPort() != 0) {
return url.getHost()+":"+url.getPort();
} else {
return url.getHost();
}
}
private ServerOptionList decideWhichServer(String url) {
if (IGNORE_TX_REGISTRY || !useEcosystem) {
return new ServerOptionList(getMasterClient().getAddress());
@ -545,7 +554,7 @@ public class TerminologyClientManager {
}
if (server.contains("://tx.fhir.org")) {
try {
server = server.replace("tx.fhir.org", new URL(getMasterClient().getAddress()).getHost());
server = server.replace("tx.fhir.org", host());
} catch (MalformedURLException e) {
}
}
@ -627,7 +636,7 @@ public class TerminologyClientManager {
}
if (server.contains("://tx.fhir.org")) {
try {
server = server.replace("tx.fhir.org", new URL(getMasterClient().getAddress()).getHost());
server = server.replace("tx.fhir.org", host());
} catch (MalformedURLException e) {
}
}