Create client from configured client factory
In the FHIR Tester application, actually use the client factory property configured in the tester configuration.
This commit is contained in:
parent
a5a18b9a14
commit
2f6aa4d272
|
@ -1112,7 +1112,8 @@ public class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Conformance loadAndAddConfDstu1(HttpServletRequest theServletRequest, final HomeRequest theRequest, final ModelMap theModel) {
|
private Conformance loadAndAddConfDstu1(HttpServletRequest theServletRequest, final HomeRequest theRequest, final ModelMap theModel) {
|
||||||
IGenericClient client = getContext(theRequest).newRestfulGenericClient(theRequest.getServerBase(theServletRequest, myConfig));
|
CaptureInterceptor interceptor = new CaptureInterceptor();
|
||||||
|
GenericClient client = theRequest.newClient(theServletRequest, getContext(theRequest), myConfig, interceptor);
|
||||||
|
|
||||||
Conformance conformance;
|
Conformance conformance;
|
||||||
try {
|
try {
|
||||||
|
@ -1171,7 +1172,8 @@ public class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
private IResource loadAndAddConfDstu2(HttpServletRequest theServletRequest, final HomeRequest theRequest, final ModelMap theModel) {
|
private IResource loadAndAddConfDstu2(HttpServletRequest theServletRequest, final HomeRequest theRequest, final ModelMap theModel) {
|
||||||
IGenericClient client = getContext(theRequest).newRestfulGenericClient(theRequest.getServerBase(theServletRequest, myConfig));
|
CaptureInterceptor interceptor = new CaptureInterceptor();
|
||||||
|
GenericClient client = theRequest.newClient(theServletRequest, getContext(theRequest), myConfig, interceptor);
|
||||||
|
|
||||||
ca.uhn.fhir.model.dstu2.resource.Conformance conformance;
|
ca.uhn.fhir.model.dstu2.resource.Conformance conformance;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import ca.uhn.fhir.rest.server.EncodingEnum;
|
||||||
import ca.uhn.fhir.rest.server.IncomingRequestAddressStrategy;
|
import ca.uhn.fhir.rest.server.IncomingRequestAddressStrategy;
|
||||||
import ca.uhn.fhir.to.Controller;
|
import ca.uhn.fhir.to.Controller;
|
||||||
import ca.uhn.fhir.to.TesterConfig;
|
import ca.uhn.fhir.to.TesterConfig;
|
||||||
|
import ca.uhn.fhir.util.ITestingUiClientFactory;
|
||||||
|
|
||||||
public class HomeRequest {
|
public class HomeRequest {
|
||||||
|
|
||||||
|
@ -124,7 +125,17 @@ public class HomeRequest {
|
||||||
public GenericClient newClient(HttpServletRequest theRequest, FhirContext theContext, TesterConfig theConfig, Controller.CaptureInterceptor theInterceptor) {
|
public GenericClient newClient(HttpServletRequest theRequest, FhirContext theContext, TesterConfig theConfig, Controller.CaptureInterceptor theInterceptor) {
|
||||||
theContext.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
|
theContext.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
|
||||||
|
|
||||||
GenericClient retVal = (GenericClient) theContext.newRestfulGenericClient(getServerBase(theRequest, theConfig));
|
GenericClient retVal;
|
||||||
|
ITestingUiClientFactory clientFactory = theConfig.getClientFactory();
|
||||||
|
if (clientFactory != null) {
|
||||||
|
retVal = (GenericClient) clientFactory.newClient(
|
||||||
|
theContext,
|
||||||
|
theRequest,
|
||||||
|
getServerBase(theRequest, theConfig));
|
||||||
|
} else {
|
||||||
|
retVal = (GenericClient) theContext.newRestfulGenericClient(getServerBase(theRequest, theConfig));
|
||||||
|
}
|
||||||
|
|
||||||
retVal.setKeepResponses(true);
|
retVal.setKeepResponses(true);
|
||||||
|
|
||||||
if ("true".equals(getPretty())) {
|
if ("true".equals(getPretty())) {
|
||||||
|
|
Loading…
Reference in New Issue