From e2be963a0dbbe21f49c6c1b1c78d647e7bbff774 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Sun, 31 Mar 2019 12:35:48 -0400 Subject: [PATCH 01/10] Add support for websockets --- .../fhir/jpa/starter/FhirServerConfigDstu2.java | 2 +- .../fhir/jpa/starter/FhirServerConfigDstu3.java | 2 +- .../uhn/fhir/jpa/starter/FhirServerConfigR4.java | 2 +- .../ca/uhn/fhir/jpa/starter/HapiProperties.java | 10 ---------- src/main/resources/hapi.properties | 11 ++++++----- .../fhir/jpa/starter/ExampleServerDstu2IT.java | 16 +++++----------- .../fhir/jpa/starter/ExampleServerDstu3IT.java | 13 ++++++------- .../uhn/fhir/jpa/starter/ExampleServerR4IT.java | 15 +++++++-------- 8 files changed, 27 insertions(+), 44 deletions(-) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigDstu2.java b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigDstu2.java index 2335e53..3255de7 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigDstu2.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigDstu2.java @@ -35,7 +35,7 @@ public class FhirServerConfigDstu2 extends BaseJavaConfigDstu2 { @Bean() public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); - retVal.setPersistenceUnitName(HapiProperties.getPersistenceUnitName()); + retVal.setPersistenceUnitName("HAPI_PU"); try { retVal.setDataSource(myDataSource); diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigDstu3.java b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigDstu3.java index 3eb1d9e..7cf6996 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigDstu3.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigDstu3.java @@ -35,7 +35,7 @@ public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 { @Bean() public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); - retVal.setPersistenceUnitName(HapiProperties.getPersistenceUnitName()); + retVal.setPersistenceUnitName("HAPI_PU"); try { retVal.setDataSource(myDataSource); diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigR4.java b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigR4.java index a9957e9..abf6938 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigR4.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigR4.java @@ -35,7 +35,7 @@ public class FhirServerConfigR4 extends BaseJavaConfigR4 { @Bean() public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(); - retVal.setPersistenceUnitName(HapiProperties.getPersistenceUnitName()); + retVal.setPersistenceUnitName("HAPI_PU"); try { retVal.setDataSource(myDataSource); diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/HapiProperties.java b/src/main/java/ca/uhn/fhir/jpa/starter/HapiProperties.java index ad426e9..d15c840 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/HapiProperties.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/HapiProperties.java @@ -32,9 +32,7 @@ public class HapiProperties { static final String LOGGER_NAME = "logger.name"; static final String MAX_FETCH_SIZE = "max_fetch_size"; static final String MAX_PAGE_SIZE = "max_page_size"; - static final String PERSISTENCE_UNIT_NAME = "persistence_unit_name"; static final String SERVER_ADDRESS = "server_address"; - static final String SERVER_BASE = "server.base"; static final String SERVER_ID = "server.id"; static final String SERVER_NAME = "server.name"; static final String SUBSCRIPTION_EMAIL_ENABLED = "subscription.email.enabled"; @@ -201,10 +199,6 @@ public class HapiProperties { return HapiProperties.getIntegerProperty(MAX_FETCH_SIZE, Integer.MAX_VALUE); } - public static String getPersistenceUnitName() { - return HapiProperties.getProperty(PERSISTENCE_UNIT_NAME, "HAPI_PU"); - } - public static String getLoggerName() { return HapiProperties.getProperty(LOGGER_NAME, "fhirtest.access"); } @@ -269,10 +263,6 @@ public class HapiProperties { return HapiProperties.getProperty(CORS_ALLOWED_ORIGIN, "*"); } - public static String getServerBase() { - return HapiProperties.getProperty(SERVER_BASE, "/fhir"); - } - public static String getServerName() { return HapiProperties.getProperty(SERVER_NAME, "Local Tester"); } diff --git a/src/main/resources/hapi.properties b/src/main/resources/hapi.properties index 5487134..8b661b5 100644 --- a/src/main/resources/hapi.properties +++ b/src/main/resources/hapi.properties @@ -6,11 +6,12 @@ fhir_version=DSTU3 # This is the address that the FHIR server will report as its own address. # If this server will be deployed (for example) to an internet accessible # server, put the DNS name of that server here. -server_address=http://localhost:8080/fhir/ - -# This is the context path for the FHIR endpoint. If this is changed, the -# setting above should also be changed. -server.base=/fhir +# +# Note that this is also the address that the hapi-fhir-testpage-overlay +# (the web UI similar to the one at http://hapi.fhir.org) will use to +# connect internally to the FHIR server, so this also needs to be a name +# accessible from the server itself. +server_address=http://localhost:8080/hapi-fhir-jpaserver/fhir/ default_encoding=JSON etag_support=ENABLED diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java index e01fc8b..70b4e5f 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu2IT.java @@ -13,8 +13,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import java.io.File; -import java.io.IOException; import java.nio.file.Paths; import static org.junit.Assert.assertEquals; @@ -33,14 +31,13 @@ public class ExampleServerDstu2IT { HapiProperties.forceReload(); HapiProperties.setProperty(HapiProperties.FHIR_VERSION, "DSTU2"); HapiProperties.setProperty(HapiProperties.DATASOURCE_URL, "jdbc:derby:memory:dbr2;create=true"); - HapiProperties.setProperty(HapiProperties.TEST_PORT, Integer.toString(PortUtil.findFreePort())); ourCtx = FhirContext.forDstu2(); - ourPort = HapiProperties.getTestPort(); + ourPort = PortUtil.findFreePort(); } @Test - public void testCreateAndRead() throws IOException { - ourLog.info("Base URL is: http://localhost:" + ourPort + HapiProperties.getServerBase()); + public void testCreateAndRead() { + ourLog.info("Base URL is: " + HapiProperties.getServerAddress()); String methodName = "testCreateResourceConditional"; Patient pt = new Patient(); @@ -62,13 +59,10 @@ public class ExampleServerDstu2IT { ourLog.info("Project base path is: {}", path); - if (ourPort == 0) { - ourPort = RandomServerPortProvider.findFreePort(); - } ourServer = new Server(ourPort); WebAppContext webAppContext = new WebAppContext(); - webAppContext.setContextPath("/"); + 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); @@ -78,7 +72,7 @@ public class ExampleServerDstu2IT { ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000); - ourServerBase = "http://localhost:" + ourPort + HapiProperties.getServerBase(); + ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/"; ourClient = ourCtx.newRestfulGenericClient(ourServerBase); ourClient.registerInterceptor(new LoggingInterceptor(true)); } diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java index c481402..4580f9c 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerDstu3IT.java @@ -44,15 +44,14 @@ public class ExampleServerDstu3IT { HapiProperties.forceReload(); HapiProperties.setProperty(HapiProperties.FHIR_VERSION, "DSTU3"); HapiProperties.setProperty(HapiProperties.DATASOURCE_URL, "jdbc:derby:memory:dbr3;create=true"); - HapiProperties.setProperty(HapiProperties.TEST_PORT, Integer.toString(PortUtil.findFreePort())); HapiProperties.setProperty(HapiProperties.SUBSCRIPTION_WEBSOCKET_ENABLED, "true"); ourCtx = FhirContext.forDstu3(); - ourPort = HapiProperties.getTestPort(); + ourPort = PortUtil.findFreePort(); } @Test - public void testCreateAndRead() throws IOException { - ourLog.info("Base URL is: http://localhost:" + ourPort + HapiProperties.getServerBase()); + public void testCreateAndRead() { + ourLog.info("Base URL is: " + HapiProperties.getServerAddress()); String methodName = "testCreateResourceConditional"; Patient pt = new Patient(); @@ -92,7 +91,7 @@ public class ExampleServerDstu3IT { SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(), EncodingEnum.JSON); myWebSocketClient.start(); - URI echoUri = new URI("ws://localhost:" + ourPort + "/websocket"); + URI echoUri = new URI("ws://localhost:" + ourPort + "/hapi-fhir-jpaserver/websocket"); ClientUpgradeRequest request = new ClientUpgradeRequest(); ourLog.info("Connecting to : {}", echoUri); Future connection = myWebSocketClient.connect(mySocketImplementation, echoUri, request); @@ -138,7 +137,7 @@ public class ExampleServerDstu3IT { ourServer = new Server(ourPort); WebAppContext webAppContext = new WebAppContext(); - webAppContext.setContextPath("/"); + 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); @@ -148,7 +147,7 @@ public class ExampleServerDstu3IT { ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000); - ourServerBase = "http://localhost:" + ourPort + HapiProperties.getServerBase(); + ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/"; ourClient = ourCtx.newRestfulGenericClient(ourServerBase); ourClient.registerInterceptor(new LoggingInterceptor(true)); } diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java index ce77acd..3d87090 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java @@ -45,15 +45,14 @@ public class ExampleServerR4IT { HapiProperties.forceReload(); HapiProperties.setProperty(HapiProperties.DATASOURCE_URL, "jdbc:derby:memory:dbr4;create=true"); HapiProperties.setProperty(HapiProperties.FHIR_VERSION, "R4"); - HapiProperties.setProperty(HapiProperties.TEST_PORT, Integer.toString(PortUtil.findFreePort())); HapiProperties.setProperty(HapiProperties.SUBSCRIPTION_WEBSOCKET_ENABLED, "true"); ourCtx = FhirContext.forR4(); - ourPort = HapiProperties.getTestPort(); + ourPort = PortUtil.findFreePort(); } @Test - public void testCreateAndRead() throws IOException { - ourLog.info("Base URL is: http://localhost:" + ourPort + HapiProperties.getServerBase()); + public void testCreateAndRead() { + ourLog.info("Base URL is: " + HapiProperties.getServerAddress()); String methodName = "testCreateResourceConditional"; Patient pt = new Patient(); @@ -93,7 +92,7 @@ public class ExampleServerR4IT { SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(), EncodingEnum.JSON); myWebSocketClient.start(); - URI echoUri = new URI("ws://localhost:" + ourPort + "/websocket"); + URI echoUri = new URI("ws://localhost:" + ourPort + "/hapi-fhir-jpaserver/websocket"); ClientUpgradeRequest request = new ClientUpgradeRequest(); ourLog.info("Connecting to : {}", echoUri); Future connection = myWebSocketClient.connect(mySocketImplementation, echoUri, request); @@ -139,7 +138,7 @@ public class ExampleServerR4IT { ourServer = new Server(ourPort); WebAppContext webAppContext = new WebAppContext(); - webAppContext.setContextPath("/"); + 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"); @@ -150,8 +149,8 @@ public class ExampleServerR4IT { ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000); - ourServerBase = "http://localhost:" + ourPort + HapiProperties.getServerBase(); - ourClient = ourCtx.newRestfulGenericClient(ourServerBase); + ourServerBase = HapiProperties.getServerAddress(); + ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/"; ourClient.registerInterceptor(new LoggingInterceptor(true)); } From 632d4ee97b486ff0c11f863cf0acde779ae4b478 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Sun, 31 Mar 2019 13:11:04 -0400 Subject: [PATCH 02/10] Fix build issues --- README.md | 13 ++++++++++++- pom.xml | 12 ++---------- src/main/resources/hapi.properties | 3 ++- .../ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java | 3 ++- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 7def907..840f40d 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ mvn jetty:run Then, browse to the following link to use the server: -[http://localhost:8080/](http://localhost:8080/) +[http://localhost:8080/hapi-fhir-jpaserver/](http://localhost:8080/hapi-fhir-jpaserver/) # Deploying to a Container @@ -74,3 +74,14 @@ FLUSH PRIVILEGES; * hibernate.dialect=org.hibernate.dialect.MySQL5Dialect It is important to use MySQL5Dialect when using MySQL version 5+. + +# Enabling Subscriptions + +The server may be configured with subscription support by enabling properties in the [hapi.properties](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/blob/master/src/main/resources/hapi.properties) file: + +* `subscription.resthook.enabled` - Enables REST Hook subscriptions, where the server will make an outgoing connection to a remote REST server + +* `subscription.email.enabled` - Enables email subscriptions. Note that you must also provide the connection details for a usable SMTP server. + +* `subscription.websocket.enabled` - Enables websocket subscriptions. With this enabled, your server will accept incoming websocket connections on the following URL (this example uses the default context path and port, you may need to tweak depending on your deployment environment): [ws://localhost:8080/hapi-fhir-jpaserver/websocket](ws://localhost:8080/hapi-fhir-jpaserver/websocket) + diff --git a/pom.xml b/pom.xml index ca54c6b..736b08b 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0 + 3.8.0-SNAPSHOT ca.uhn.hapi.fhir.demo @@ -129,14 +129,6 @@ org.apache.derby derby - - org.apache.derby - derbynet - - - org.apache.derby - derbyclient - @@ -204,7 +196,7 @@ 9.4.8.v20180619 - / + /hapi-fhir-jpaserver true diff --git a/src/main/resources/hapi.properties b/src/main/resources/hapi.properties index 8b661b5..e128f2c 100644 --- a/src/main/resources/hapi.properties +++ b/src/main/resources/hapi.properties @@ -1,6 +1,7 @@ # Adjust this to set the version of FHIR supported by this server. See -# FhirVersionEnum for a list of available constants. +# FhirVersionEnum for a list of available constants. Example values include +# DSTU2, DSTU3, R4. fhir_version=DSTU3 # This is the address that the FHIR server will report as its own address. diff --git a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java index 3d87090..bff12bb 100644 --- a/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java +++ b/src/test/java/ca/uhn/fhir/jpa/starter/ExampleServerR4IT.java @@ -22,7 +22,6 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import java.io.IOException; import java.net.URI; import java.nio.file.Paths; import java.util.concurrent.Future; @@ -151,6 +150,8 @@ public class ExampleServerR4IT { ourCtx.getRestfulClientFactory().setSocketTimeout(1200 * 1000); ourServerBase = HapiProperties.getServerAddress(); ourServerBase = "http://localhost:" + ourPort + "/hapi-fhir-jpaserver/fhir/"; + + ourClient = ourCtx.newRestfulGenericClient(ourServerBase); ourClient.registerInterceptor(new LoggingInterceptor(true)); } From ba4f051375bdcec5df3b4cd6e1988248fbb250e9 Mon Sep 17 00:00:00 2001 From: Sean McIlvenna Date: Wed, 1 May 2019 09:54:16 -0700 Subject: [PATCH 03/10] Adding javax.mail dependency to pom.xml so that when properties are configured to enable mail, the pom.xml doesn't have to be additionally modified for it to work. --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index ca54c6b..6a05dc8 100644 --- a/pom.xml +++ b/pom.xml @@ -46,6 +46,11 @@ mysql-connector-java 6.0.5 + + javax.mail + javax.mail-api + 1.5.2 + From ba221f3f70bb85ea03f2144df3d441c547c7e521 Mon Sep 17 00:00:00 2001 From: Sean McIlvenna Date: Wed, 1 May 2019 09:55:31 -0700 Subject: [PATCH 04/10] changing tab delimination to 4 spaces instead of actual tabs --- pom.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 6a05dc8..f188e53 100644 --- a/pom.xml +++ b/pom.xml @@ -46,11 +46,11 @@ mysql-connector-java 6.0.5 - - javax.mail - javax.mail-api - 1.5.2 - + + javax.mail + javax.mail-api + 1.5.2 + From 4d224b6b50cea741450d262eb87d71c0adfac834 Mon Sep 17 00:00:00 2001 From: Sean McIlvenna Date: Wed, 1 May 2019 14:01:30 -0700 Subject: [PATCH 05/10] Reverting recent change to increment hapi-fhir parent to 3.8.0. Now returning it back to 3.7.0 because 3.8.0 has not yet been published on maven (according to https://search.maven.org/artifact/ca.uhn.hapi.fhir/hapi-fhir/) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 11600aa..ddea301 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.8.0-SNAPSHOT + 3.7.0-SNAPSHOT ca.uhn.hapi.fhir.demo From 9a51f384adcaa600d25cb97a2c8a5f5f0ec490aa Mon Sep 17 00:00:00 2001 From: Sean McIlvenna Date: Wed, 1 May 2019 14:07:46 -0700 Subject: [PATCH 06/10] parent shouldn't have -SNAPSHOT in the version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ddea301..8e12409 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ ca.uhn.hapi.fhir hapi-fhir - 3.7.0-SNAPSHOT + 3.7.0 ca.uhn.hapi.fhir.demo From a96828c747f720acb0ccd18de3695749e2581b9c Mon Sep 17 00:00:00 2001 From: James Agnew Date: Sat, 4 May 2019 15:38:44 -0400 Subject: [PATCH 07/10] Register email sender --- .../uhn/fhir/jpa/starter/FhirServerConfigCommon.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java index 7e5879d..cfd8435 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/FhirServerConfigCommon.java @@ -4,11 +4,13 @@ import java.lang.reflect.InvocationTargetException; import java.sql.Driver; import ca.uhn.fhir.jpa.model.entity.ModelConfig; +import ca.uhn.fhir.jpa.subscription.module.cache.SubscriptionDeliveryHandlerFactory; import ca.uhn.fhir.jpa.subscription.module.subscriber.email.IEmailSender; import ca.uhn.fhir.jpa.subscription.module.subscriber.email.JavaMailEmailSender; import org.apache.commons.dbcp2.BasicDataSource; import org.hl7.fhir.instance.model.Subscription; import org.springframework.beans.factory.annotation.Autowire; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.transaction.annotation.EnableTransactionManagement; @@ -17,6 +19,7 @@ import ca.uhn.fhir.jpa.dao.DaoConfig; import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; import ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor; import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor; +import org.thymeleaf.util.Validate; /** * This is the primary configuration file for the example server @@ -171,6 +174,10 @@ public class FhirServerConfigCommon { return retVal; } + + @Autowired + private SubscriptionDeliveryHandlerFactory mySubscriptionDeliveryHandlerFactory; + @Bean() public IEmailSender emailSender() { if (this.emailEnabled) { @@ -181,6 +188,10 @@ public class FhirServerConfigCommon { retVal.setSmtpServerUsername(this.emailUsername); retVal.setSmtpServerPassword(this.emailPassword); + Validate.notNull(mySubscriptionDeliveryHandlerFactory, "No subscription delivery handler"); + mySubscriptionDeliveryHandlerFactory.setEmailSender(retVal); + + return retVal; } From 3f96c90c42442db1b0109e4a88fd99fb122001cd Mon Sep 17 00:00:00 2001 From: James Agnew Date: Sat, 4 May 2019 15:49:01 -0400 Subject: [PATCH 08/10] Add missing dependency --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index 8e12409..1a8bc72 100644 --- a/pom.xml +++ b/pom.xml @@ -186,6 +186,12 @@ provided + + + javax.mail + javax.mail-api + + From b3a0f84712b441a58c075670d093fd7e400184d7 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Sat, 4 May 2019 15:55:30 -0400 Subject: [PATCH 09/10] More dependency fixes --- pom.xml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 1a8bc72..e411811 100644 --- a/pom.xml +++ b/pom.xml @@ -16,20 +16,6 @@ ca.uhn.hapi.fhir.demo hapi-fhir-jpaserver-starter - war - - HAPI FHIR JPA Server - Starter Project - - - - oss-snapshots - - false - - https://oss.sonatype.org/content/repositories/snapshots/ - - - org.eclipse.jetty.websocket @@ -46,10 +32,15 @@ mysql-connector-java 6.0.5 + + + + com.sun.mail + javax.mail + javax.mail javax.mail-api - 1.5.2 @@ -186,14 +177,23 @@ provided - - - javax.mail - javax.mail-api - + war + + HAPI FHIR JPA Server - Starter Project + + + + oss-snapshots + + false + + https://oss.sonatype.org/content/repositories/snapshots/ + + + From 09141dd64b8f62b5433dc8d9bf1d5126b7d2d535 Mon Sep 17 00:00:00 2001 From: Sean McIlvenna Date: Sun, 5 May 2019 10:49:24 -0400 Subject: [PATCH 10/10] Adding the "Prefer" header as an allowed header by cors when cors is enabled --- src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java b/src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java index c0a3403..a69c546 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java @@ -179,6 +179,7 @@ public class JpaRestfulServer extends RestfulServer { config.addAllowedHeader("Accept"); config.addAllowedHeader("X-Requested-With"); config.addAllowedHeader("Content-Type"); + config.addAllowedHeader("Prefer"); config.addAllowedOrigin(HapiProperties.getCorsAllowedOrigin());