Merge pull request #211 from pukkaone/tester-client-factory

FHIR Tester application use configured client factory
This commit is contained in:
James Agnew 2015-08-25 07:46:17 -04:00
commit d6540a9759
3 changed files with 19 additions and 6 deletions

View File

@ -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 {

View File

@ -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())) {

View File

@ -70,8 +70,8 @@
</overlays> </overlays>
</configuration> </configuration>
</plugin> </plugin>
</build> </plugins>
</plugins>]]></source> </build>]]></source>
</p> </p>
<p> <p>