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

Commit f01be01

Browse files
committed
server validation set to NEVER
the default hapi fhir client tries to download a conformance statement from the server fist, this config disables that
1 parent 8df92f3 commit f01be01

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

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

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616
import ca.uhn.fhir.rest.api.MethodOutcome;
1717
import ca.uhn.fhir.rest.api.RequestFormatParamStyleEnum;
1818
import ca.uhn.fhir.rest.api.SummaryEnum;
19+
import ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory;
1920
import ca.uhn.fhir.rest.client.api.IGenericClient;
2021
import ca.uhn.fhir.rest.client.api.IHttpClient;
22+
import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
2123
import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException;
2224
import ca.uhn.fhir.rest.client.interceptor.BasicAuthInterceptor;
2325
import ca.uhn.fhir.rest.client.interceptor.BearerTokenAuthInterceptor;
@@ -47,6 +49,8 @@ public class HapiFhirClientFactory
4749
private final String bearerToken;
4850
private final boolean supportsIdentifierReferenceSearch;
4951

52+
private final ApacheRestfulClientFactory clientFactory;
53+
5054
/**
5155
* @param fhirContext
5256
* may be <code>null</code>, will use new {@link FhirContext#forR4()} if <code>null</code>
@@ -73,6 +77,14 @@ public HapiFhirClientFactory(FhirContext fhirContext, String serverBase, String
7377
this.basicAuthPassword = basicAuthPassword;
7478
this.bearerToken = bearerToken;
7579
this.supportsIdentifierReferenceSearch = supportsIdentifierReferenceSearch;
80+
81+
if (isConfigured())
82+
{
83+
clientFactory = new ApacheRestfulClientFactory(this.fhirContext);
84+
clientFactory.setServerValidationMode(ServerValidationModeEnum.NEVER);
85+
}
86+
else
87+
clientFactory = null;
7688
}
7789

7890
public boolean supportsIdentifierReferenceSearch()
@@ -89,7 +101,7 @@ public IGenericClient getFhirStoreClient()
89101
{
90102
if (isConfigured())
91103
{
92-
IGenericClient client = fhirContext.newRestfulGenericClient(serverBase);
104+
IGenericClient client = clientFactory.newGenericClient(serverBase);
93105
configureBasicAuthInterceptor(client);
94106
configureBearerTokenAuthInterceptor(client);
95107
return client;

0 commit comments

Comments
 (0)