ca.uhn.fhir.rest.client.api.ServerValidationModeEnum Java Examples

The following examples show how to use ca.uhn.fhir.rest.client.api.ServerValidationModeEnum. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExampleServerDstu3IT.java    From hapi-fhir-jpaserver-starter with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
	String path = Paths.get("").toAbsolutePath().toString();

	ourLog.info("Project base path is: {}", path);

	ourServer = new Server(0);

	WebAppContext webAppContext = new WebAppContext();
	webAppContext.setContextPath("/hapi-fhir-jpaserver");
	webAppContext.setDescriptor(path + "/src/main/webapp/WEB-INF/web.xml");
	webAppContext.setResourceBase(path + "/target/hapi-fhir-jpaserver-starter");
	webAppContext.setParentLoaderPriority(true);

	ourServer.setHandler(webAppContext);
	ourServer.start();

	ourPort = JettyUtil.getPortForStartedServer(ourServer);

	ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
	ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000);
	String ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/";
	ourClient = ourCtx.newRestfulGenericClient(ourServerBase);
	ourClient.registerInterceptor(new LoggingInterceptor(true));
}
 
Example #2
Source File: ExampleServerDstu2IT.java    From hapi-fhir-jpaserver-starter with Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
	String path = Paths.get("").toAbsolutePath().toString();

	ourLog.info("Project base path is: {}", path);

	ourServer = new Server(0);

	WebAppContext webAppContext = new WebAppContext();
	webAppContext.setContextPath("/hapi-fhir-jpaserver");
	webAppContext.setDescriptor(path + "/src/main/webapp/WEB-INF/web.xml");
	webAppContext.setResourceBase(path + "/target/hapi-fhir-jpaserver-starter");
	webAppContext.setParentLoaderPriority(true);

	ourServer.setHandler(webAppContext);
	ourServer.start();

	ourPort = JettyUtil.getPortForStartedServer(ourServer);

	ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
	ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000);
	String ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/";
	ourClient = ourCtx.newRestfulGenericClient(ourServerBase);
	ourClient.registerInterceptor(new LoggingInterceptor(true));
}
 
Example #3
Source File: Dstu3FhirTerminologyProvider.java    From cql_engine with Apache License 2.0 6 votes vote down vote up
public Dstu3FhirTerminologyProvider setEndpoint(String endpoint, boolean validation) {
    this.endpoint = endpoint;
    if (!validation) {
        this.fhirContext.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
    }
    fhirContext.getRestfulClientFactory().setSocketTimeout(1200 * 10000);
    fhirClient = fhirContext.newRestfulGenericClient(endpoint);

    if (this.headerInjectionInterceptor != null) {
        fhirClient.registerInterceptor(headerInjectionInterceptor);
    }

    if (userName != null && password != null) {
        BasicAuthInterceptor basicAuth = new BasicAuthInterceptor(userName, password);
        fhirClient.registerInterceptor(basicAuth);
    }
    return this;
}
 
Example #4
Source File: R4FhirTerminologyProvider.java    From cql_engine with Apache License 2.0 6 votes vote down vote up
public R4FhirTerminologyProvider setEndpoint(String endpoint, boolean validation) {
    this.endpoint = endpoint;
    if (!validation) {
        this.fhirContext.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
    }
    fhirContext.getRestfulClientFactory().setSocketTimeout(1200 * 10000);
    fhirClient = fhirContext.newRestfulGenericClient(endpoint);

    if (this.headerInjectionInterceptor != null) {
        fhirClient.registerInterceptor(headerInjectionInterceptor);
    }

    if (userName != null && password != null) {
        BasicAuthInterceptor basicAuth = new BasicAuthInterceptor(userName, password);
        fhirClient.registerInterceptor(basicAuth);
    }
    return this;
}
 
Example #5
Source File: ExampleServerR4IT.java    From hapi-fhir-jpaserver-starter with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
    String path = Paths.get("").toAbsolutePath().toString();

    ourLog.info("Project base path is: {}", path);

    ourServer = new Server(0);

    WebAppContext webAppContext = new WebAppContext();
    webAppContext.setContextPath("/hapi-fhir-jpaserver");
    webAppContext.setDisplayName("HAPI FHIR");
    webAppContext.setDescriptor(path + "/src/main/webapp/WEB-INF/web.xml");
    webAppContext.setResourceBase(path + "/target/hapi-fhir-jpaserver-starter");
    webAppContext.setParentLoaderPriority(true);

    ourServer.setHandler(webAppContext);
    ourServer.start();

    ourPort = JettyUtil.getPortForStartedServer(ourServer);

    ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
    ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000);
    String ourServerBase = HapiProperties.getServerAddress();
    ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/";

    ourClient = ourCtx.newRestfulGenericClient(ourServerBase);
    ourClient.registerInterceptor(new LoggingInterceptor(true));
}
 
Example #6
Source File: ExampleServerR5IT.java    From hapi-fhir-jpaserver-starter with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
    String path = Paths.get("").toAbsolutePath().toString();

    ourLog.info("Project base path is: {}", path);

    ourServer = new Server(0);

    WebAppContext webAppContext = new WebAppContext();
    webAppContext.setContextPath("/hapi-fhir-jpaserver");
    webAppContext.setDisplayName("HAPI FHIR");
    webAppContext.setDescriptor(path + "/src/main/webapp/WEB-INF/web.xml");
    webAppContext.setResourceBase(path + "/target/hapi-fhir-jpaserver-starter");
    webAppContext.setParentLoaderPriority(true);

    ourServer.setHandler(webAppContext);
    ourServer.start();

    ourPort = JettyUtil.getPortForStartedServer(ourServer);

    ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
    ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000);
    String ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/";

    ourClient = ourCtx.newRestfulGenericClient(ourServerBase);
    ourClient.registerInterceptor(new LoggingInterceptor(true));
}
 
Example #7
Source File: MultitenantServerR4IT.java    From hapi-fhir-jpaserver-starter with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void beforeClass() throws Exception {
  String path = Paths.get("").toAbsolutePath().toString();

  ourLog.info("Project base path is: {}", path);

  ourServer = new Server(0);

  WebAppContext webAppContext = new WebAppContext();
  webAppContext.setContextPath("/hapi-fhir-jpaserver");
  webAppContext.setDisplayName("HAPI FHIR");
  webAppContext.setDescriptor(path + "/src/main/webapp/WEB-INF/web.xml");
  webAppContext.setResourceBase(path + "/target/hapi-fhir-jpaserver-starter");
  webAppContext.setParentLoaderPriority(true);

  ourServer.setHandler(webAppContext);
  ourServer.start();

  ourPort = JettyUtil.getPortForStartedServer(ourServer);

  ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
  ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000);
  String ourServerBase = HapiProperties.getServerAddress();
  ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/";

  ourClient = ourCtx.newRestfulGenericClient(ourServerBase);
  ourClient.registerInterceptor(new LoggingInterceptor(true));

  ourClientTenantInterceptor = new UrlTenantSelectionInterceptor();
  ourClient.registerInterceptor(ourClientTenantInterceptor);
}