diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml
index 87ebd074790..b9ce90ac2b9 100644
--- a/hapi-fhir-dist/pom.xml
+++ b/hapi-fhir-dist/pom.xml
@@ -68,10 +68,6 @@
ch.qos.logback
logback-classic
-
- org.ebaysf.web
- cors-filter
-
org.thymeleaf
thymeleaf
@@ -84,6 +80,10 @@
com.phloc
phloc-commons
+
+ org.springframework
+ spring-web
+
diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml
index 3cbebddadfd..8bfab07f019 100644
--- a/hapi-fhir-jacoco/pom.xml
+++ b/hapi-fhir-jacoco/pom.xml
@@ -162,11 +162,6 @@
com.google.guava
guava
-
- org.ebaysf.web
- cors-filter
- test
-
xmlunit
xmlunit
@@ -192,6 +187,10 @@
websocket-server
test
+
+ org.springframework
+ spring-web
+
diff --git a/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml b/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml
index 76e37b9e959..7fec6b6804a 100644
--- a/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml
+++ b/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml
@@ -57,50 +57,4 @@
/
-
-
- CORS Filter
- org.apache.catalina.filters.CorsFilter
-
- A comma separated list of allowed origins. Note: An '*' cannot be used for an allowed origin when using credentials.
- cors.allowed.origins
- *
-
-
- A comma separated list of HTTP verbs, using which a CORS request can be made.
- cors.allowed.methods
- GET,POST,PUT,DELETE,OPTIONS
-
-
- A comma separated list of allowed headers when making a non simple CORS request.
- cors.allowed.headers
- X-FHIR-Starter,Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers
-
-
- A comma separated list non-standard response headers that will be exposed to XHR2 object.
- cors.exposed.headers
- Location,Content-Location
-
-
- A flag that suggests if CORS is supported with cookies
- cors.support.credentials
- true
-
-
- A flag to control logging
- cors.logging.enabled
- true
-
-
- Indicates how long (in seconds) the results of a preflight request can be cached in a preflight result cache.
- cors.preflight.maxage
- 300
-
-
-
- CORS Filter
- /*
-
-
-
diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/ErrorHandlerTest.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/ErrorHandlerTest.java
index 8dbc9e8fdb0..42d721ebff6 100644
--- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/ErrorHandlerTest.java
+++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/ErrorHandlerTest.java
@@ -2,6 +2,8 @@ package ca.uhn.fhir.parser;
import org.junit.Test;
+import ca.uhn.fhir.parser.json.JsonLikeValue.ValueType;
+
/*
* #%L
* HAPI FHIR - Core Library
@@ -43,7 +45,7 @@ public class ErrorHandlerTest {
new LenientErrorHandler().unknownElement(null, null);
new LenientErrorHandler().containedResourceWithNoId(null);
new LenientErrorHandler().unknownReference(null, null);
- new LenientErrorHandler().incorrectJsonType(null, null, null, null);
+ new LenientErrorHandler().incorrectJsonType(null, null, ValueType.ARRAY, ValueType.SCALAR);
new LenientErrorHandler().invalidValue(null, null, null);
}
@@ -74,7 +76,7 @@ public class ErrorHandlerTest {
@Test(expected = DataFormatException.class)
public void testStrictMethods6() {
- new StrictErrorHandler().incorrectJsonType(null, null, null, null);
+ new StrictErrorHandler().incorrectJsonType(null, null, ValueType.ARRAY, ValueType.SCALAR);
}
@Test(expected = DataFormatException.class)
diff --git a/pom.xml b/pom.xml
index 52cf29a3c3f..3f7b8f58f2c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1579,7 +1579,7 @@
hapi-fhir-base-test-mindeps-server
hapi-tinder-plugin
hapi-tinder-test
- hapi-fhir-narrativegenerator
+
hapi-fhir-structures-dstu
hapi-fhir-validation-resources-dstu2
hapi-fhir-structures-dstu2
diff --git a/restful-server-example/.classpath b/restful-server-example/.classpath
index fd7ad7fbda7..0b809b9cdb8 100644
--- a/restful-server-example/.classpath
+++ b/restful-server-example/.classpath
@@ -6,13 +6,18 @@
+
+
+
+
+
-
+
@@ -20,7 +25,17 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/restful-server-example/pom.xml b/restful-server-example/pom.xml
index 74535d567b9..7a6c948f459 100644
--- a/restful-server-example/pom.xml
+++ b/restful-server-example/pom.xml
@@ -93,14 +93,8 @@
- org.ebaysf.web
- cors-filter
-
-
- servlet-api
- javax.servlet
-
-
+ org.springframework
+ spring-web
diff --git a/restful-server-example/src/main/java/ca/uhn/example/servlet/ExampleRestfulServlet.java b/restful-server-example/src/main/java/ca/uhn/example/servlet/ExampleRestfulServlet.java
index d5b555f22bd..f8b0400da9a 100644
--- a/restful-server-example/src/main/java/ca/uhn/example/servlet/ExampleRestfulServlet.java
+++ b/restful-server-example/src/main/java/ca/uhn/example/servlet/ExampleRestfulServlet.java
@@ -1,8 +1,11 @@
package ca.uhn.example.servlet;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
+import org.springframework.web.cors.CorsConfiguration;
+
import ca.uhn.example.provider.OrganizationResourceProvider;
import ca.uhn.example.provider.PatientResourceProvider;
import ca.uhn.fhir.context.FhirContext;
@@ -10,6 +13,7 @@ import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.narrative.INarrativeGenerator;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer;
+import ca.uhn.fhir.rest.server.interceptor.CorsInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
/**
@@ -49,6 +53,19 @@ public class ExampleRestfulServlet extends RestfulServer {
INarrativeGenerator narrativeGen = new DefaultThymeleafNarrativeGenerator();
getFhirContext().setNarrativeGenerator(narrativeGen);
+ /*
+ * Enable CORS
+ */
+ CorsConfiguration config = new CorsConfiguration();
+ CorsInterceptor corsInterceptor = new CorsInterceptor(config);
+ config.addAllowedHeader("Accept");
+ config.addAllowedHeader("Content-Type");
+ config.addAllowedOrigin("*");
+ config.addExposedHeader("Location");
+ config.addExposedHeader("Content-Location");
+ config.setAllowedMethods(Arrays.asList("GET","POST","PUT","DELETE","OPTIONS"));
+ registerInterceptor(corsInterceptor);
+
/*
* This server interceptor causes the server to return nicely
* formatter and coloured responses instead of plain JSON/XML if
diff --git a/restful-server-example/src/main/webapp/WEB-INF/web.xml b/restful-server-example/src/main/webapp/WEB-INF/web.xml
index 319bfa280f1..49bc32a74f6 100644
--- a/restful-server-example/src/main/webapp/WEB-INF/web.xml
+++ b/restful-server-example/src/main/webapp/WEB-INF/web.xml
@@ -36,52 +36,4 @@
/fhir/*
-
-
- CORS Filter
- org.ebaysf.web.cors.CORSFilter
-
- A comma separated list of allowed origins. Note: An '*' cannot be used for an allowed origin when using credentials.
- cors.allowed.origins
- *
-
-
- A comma separated list of HTTP verbs, using which a CORS request can be made.
- cors.allowed.methods
- GET,POST,PUT,DELETE,OPTIONS
-
-
- A comma separated list of allowed headers when making a non simple CORS request.
- cors.allowed.headers
- X-FHIR-Starter,Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers
-
-
- A comma separated list non-standard response headers that will be exposed to XHR2 object.
- cors.exposed.headers
- Location,Content-Location
-
-
- A flag that suggests if CORS is supported with cookies
- cors.support.credentials
- true
-
-
- A flag to control logging
- cors.logging.enabled
- true
-
-
- Indicates how long (in seconds) the results of a preflight request can be cached in a preflight result cache.
- cors.preflight.maxage
- 300
-
-
-
- CORS Filter
- /*
-
-
\ No newline at end of file