Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Commit 9ebbc20

Browse files
committed
Merge remote-tracking branch 'origin/issues/25_fTTP_proxy_configuration'
into develop
2 parents 070c4fc + a3d3e82 commit 9ebbc20

2 files changed

Lines changed: 33 additions & 9 deletions

File tree

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/FttpClientImpl.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ public class FttpClientImpl implements FttpClient, InitializingBean
4545
private final String fttpTarget;
4646
private final String fttpApiKey;
4747

48-
private final String proxySchemeHostPort;
49-
private final String proxyUsername;
50-
private final String proxyPassword;
51-
5248
private final boolean hapiClientVerbose;
5349

5450
public FttpClientImpl(KeyStore trustStore, KeyStore keyStore, char[] keyStorePassword, int connectTimeout,
@@ -67,9 +63,7 @@ public FttpClientImpl(KeyStore trustStore, KeyStore keyStore, char[] keyStorePas
6763
this.fttpStudy = fttpStudy;
6864
this.fttpTarget = fttpTarget;
6965

70-
this.proxySchemeHostPort = proxySchemeHostPort;
71-
this.proxyUsername = proxyUsername;
72-
this.proxyPassword = proxyPassword;
66+
configureProxy(clientFactory, proxySchemeHostPort, proxyUsername, proxyPassword);
7367

7468
this.hapiClientVerbose = hapiClientVerbose;
7569
}
@@ -85,7 +79,6 @@ protected ApacheRestfulClientFactoryWithTlsConfig createClientFactory(KeyStore t
8579
ApacheRestfulClientFactoryWithTlsConfig hapiClientFactory = new ApacheRestfulClientFactoryWithTlsConfig(
8680
fhirContext, trustStore, keyStore, keyStorePassword);
8781
hapiClientFactory.setServerValidationMode(ServerValidationModeEnum.NEVER);
88-
configureProxy(hapiClientFactory);
8982

9083
hapiClientFactory.setConnectTimeout(connectTimeout);
9184
hapiClientFactory.setSocketTimeout(socketTimeout);
@@ -95,7 +88,8 @@ protected ApacheRestfulClientFactoryWithTlsConfig createClientFactory(KeyStore t
9588
return hapiClientFactory;
9689
}
9790

98-
private void configureProxy(ApacheRestfulClientFactoryWithTlsConfig clientFactory)
91+
private void configureProxy(IRestfulClientFactory clientFactory, String proxySchemeHostPort, String proxyUsername,
92+
String proxyPassword)
9993
{
10094
if (StringUtils.isNotBlank(proxySchemeHostPort))
10195
{

codex-process-data-transfer/src/main/java/de/netzwerk_universitaetsmedizin/codex/processes/data_transfer/client/HapiFhirClientFactory.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44

55
import org.hl7.fhir.instance.model.api.IBaseBundle;
66
import org.hl7.fhir.instance.model.api.IBaseResource;
7+
import org.hl7.fhir.r4.model.CapabilityStatement;
78
import org.slf4j.Logger;
89
import org.slf4j.LoggerFactory;
10+
import org.springframework.context.event.ContextRefreshedEvent;
11+
import org.springframework.context.event.EventListener;
912

1013
import ca.uhn.fhir.context.FhirContext;
1114
import ca.uhn.fhir.interceptor.api.IInterceptorService;
@@ -99,6 +102,33 @@ public HapiFhirClientFactory(FhirContext fhirContext, String serverBase, String
99102
clientFactory = null;
100103
}
101104

105+
@EventListener({ ContextRefreshedEvent.class })
106+
public void onContextRefreshedEvent(ContextRefreshedEvent event)
107+
{
108+
if (isConfigured())
109+
{
110+
try
111+
{
112+
logger.info(
113+
"Testing connection to GECCO FHIR server with {basicAuthUsername: {}, basicAuthPassword: {}, bearerToken: {}, serverBase: {}}",
114+
basicAuthUsername, basicAuthPassword != null ? "***" : "null",
115+
bearerToken != null ? "***" : "null", serverBase);
116+
117+
CapabilityStatement statement = getFhirStoreClient().capabilities().ofType(CapabilityStatement.class)
118+
.execute();
119+
120+
logger.info("Connection test OK {} - {}", statement.getSoftware().getName(),
121+
statement.getSoftware().getVersion());
122+
}
123+
catch (Exception e)
124+
{
125+
logger.error("Error while testing connection to GECCO FHIR server", e);
126+
}
127+
}
128+
else
129+
logger.warn("GECCO FHIR server Client stub implementation, no connection test performed");
130+
}
131+
102132
protected boolean isConfigured()
103133
{
104134
return serverBase != null && !serverBase.isEmpty();

0 commit comments

Comments
 (0)