diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml
index 76fbbaa3c10..906337f3cd4 100644
--- a/hapi-fhir-android/pom.xml
+++ b/hapi-fhir-android/pom.xml
@@ -64,18 +64,21 @@
slf4j-android
${slf4j_version}
-
-
+
+ org.slf4j
+ slf4j-api
+ ${slf4j_version}
+ test
+
commons-io
commons-io
${commons_io_version}
+ test
-
+
javax.servlet
javax.servlet-api
@@ -134,11 +137,10 @@
true
-
+
commons-codec:commons-codec
- commons-io:commons-io
ca.uhn.hapi.fhir:hapi-fhir-base
ca.uhn.hapi.fhir:hapi-fhir-structures-dstu
ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2
@@ -147,7 +149,7 @@
javax.xml.stream:stax-api
javax.servlet:javax.servlet-api
org.codehaus.woodstox:stax2-api
-
+
org.apache.commons:*
org.apache.httpcomponents:*
org.glassfish:javax.json
@@ -178,7 +180,7 @@
-
+
DIST
@@ -207,5 +209,5 @@
-
+
diff --git a/hapi-fhir-android/src/main/java/ca/uhn/fhir/android/AndroidLoader.java b/hapi-fhir-android/src/main/java/ca/uhn/fhir/android/AndroidLoader.java
new file mode 100644
index 00000000000..f7e1b685601
--- /dev/null
+++ b/hapi-fhir-android/src/main/java/ca/uhn/fhir/android/AndroidLoader.java
@@ -0,0 +1,14 @@
+package ca.uhn.fhir.android;
+
+import ca.uhn.fhir.context.FhirContext;
+
+public class AndroidLoader {
+
+ public static void main(String[] theArgs) {
+ FhirContext ctx = FhirContext.forDstu2();
+ ctx.newJsonParser();
+ ctx.newXmlParser();
+ ctx.newRestfulGenericClient("");
+ }
+
+}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseResourceReturningMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseResourceReturningMethodBinding.java
index fe667ddfa18..549744f78dd 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseResourceReturningMethodBinding.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/method/BaseResourceReturningMethodBinding.java
@@ -279,7 +279,7 @@ abstract class BaseResourceReturningMethodBinding extends BaseMethodBinding includes = getRequestIncludesFromParams(params);
@@ -312,7 +312,7 @@ abstract class BaseResourceReturningMethodBinding extends BaseMethodBinding resourceType) {
- this.myDeclaredResourceType = resourceType;
- }
-
@Override
- public String toString() {
- return getMethod().toString();
+ protected boolean isAddContentLocationHeader() {
+ return false;
}
private List processWhitelistAndBlacklist(List theQualifiedNames, Set theQualifierWhitelist, Set theQualifierBlacklist) {
@@ -313,6 +314,15 @@ public class SearchMethodBinding extends BaseResourceReturningMethodBinding {
return retVal;
}
+ public void setResourceType(Class extends IResource> resourceType) {
+ this.myDeclaredResourceType = resourceType;
+ }
+
+ @Override
+ public String toString() {
+ return getMethod().toString();
+ }
+
public static BaseHttpClientInvocation createSearchInvocation(FhirContext theContext, String theResourceName, Map> theParameters, IdDt theId, String theCompartmentName,
SearchStyleEnum theSearchStyle) {
SearchStyleEnum searchStyle = theSearchStyle;
@@ -473,9 +483,4 @@ public class SearchMethodBinding extends BaseResourceReturningMethodBinding {
}
- @Override
- protected BundleTypeEnum getResponseBundleType() {
- return BundleTypeEnum.SEARCHSET;
- }
-
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
index 557a2d10b3e..5580492d90f 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java
@@ -490,7 +490,7 @@ public class RestfulServer extends HttpServlet {
return;
}
}
- RestfulServerUtils.streamResponseAsResource(this, theResponse, (IResource) resBundle, responseEncoding, prettyPrint, requestIsBrowser, narrativeMode, Constants.STATUS_HTTP_200_OK, theRequest.isRespondGzip(), theRequest.getFhirServerBase());
+ RestfulServerUtils.streamResponseAsResource(this, theResponse, (IResource) resBundle, responseEncoding, prettyPrint, requestIsBrowser, narrativeMode, Constants.STATUS_HTTP_200_OK, theRequest.isRespondGzip(), theRequest.getFhirServerBase(), false);
}
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java
index 6c16d40dcd4..27be55ace35 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java
@@ -73,10 +73,10 @@ public class RestfulServerUtils {
}
public static void streamResponseAsResource(RestfulServer theServer, HttpServletResponse theHttpResponse, IResource theResource, EncodingEnum theResponseEncoding, boolean thePrettyPrint,
- boolean theRequestIsBrowser, RestfulServer.NarrativeModeEnum theNarrativeMode, int stausCode, boolean theRespondGzip, String theServerBase) throws IOException {
+ boolean theRequestIsBrowser, RestfulServer.NarrativeModeEnum theNarrativeMode, int stausCode, boolean theRespondGzip, String theServerBase, boolean theAddContentLocationHeader) throws IOException {
theHttpResponse.setStatus(stausCode);
- if (theResource.getId() != null && theResource.getId().hasIdPart() && isNotBlank(theServerBase)) {
+ if (theAddContentLocationHeader && theResource.getId() != null && theResource.getId().hasIdPart() && isNotBlank(theServerBase)) {
String resName = theServer.getFhirContext().getResourceDefinition(theResource).getName();
IdDt fullId = theResource.getId().withServerBase(theServerBase, resName);
theHttpResponse.addHeader(Constants.HEADER_CONTENT_LOCATION, fullId.getValue());
@@ -402,12 +402,12 @@ public class RestfulServerUtils {
}
}
- public static void streamResponseAsResource(RestfulServer theServer, HttpServletResponse theHttpResponse, IResource theResource, EncodingEnum theResponseEncoding, boolean thePrettyPrint,
- boolean theRequestIsBrowser, RestfulServer.NarrativeModeEnum theNarrativeMode, boolean theRespondGzip, String theServerBase) throws IOException {
- int stausCode = 200;
- RestfulServerUtils.streamResponseAsResource(theServer, theHttpResponse, theResource, theResponseEncoding, thePrettyPrint, theRequestIsBrowser, theNarrativeMode, stausCode, theRespondGzip,
- theServerBase);
- }
+// public static void streamResponseAsResource(RestfulServer theServer, HttpServletResponse theHttpResponse, IResource theResource, EncodingEnum theResponseEncoding, boolean thePrettyPrint,
+// boolean theRequestIsBrowser, RestfulServer.NarrativeModeEnum theNarrativeMode, boolean theRespondGzip, String theServerBase) throws IOException {
+// int stausCode = 200;
+// RestfulServerUtils.streamResponseAsResource(theServer, theHttpResponse, theResource, theResponseEncoding, thePrettyPrint, theRequestIsBrowser, theNarrativeMode, stausCode, theRespondGzip,
+// theServerBase);
+// }
public static void validateResourceListNotNull(List theResourceList) {
if (theResourceList == null) {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/interceptor/ExceptionHandlingInterceptor.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/interceptor/ExceptionHandlingInterceptor.java
index a8987477d3c..8737104ff11 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/interceptor/ExceptionHandlingInterceptor.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/interceptor/ExceptionHandlingInterceptor.java
@@ -129,7 +129,7 @@ public class ExceptionHandlingInterceptor extends InterceptorAdapter {
boolean requestIsBrowser = RestfulServer.requestIsBrowser(theRequest);
String fhirServerBase = ((Request) theRequestDetails).getFhirServerBase();
RestfulServerUtils.streamResponseAsResource(theRequestDetails.getServer(), theResponse, oo, RestfulServerUtils.determineResponseEncodingNoDefault(theRequest), true, requestIsBrowser,
- NarrativeModeEnum.NORMAL, statusCode, false, fhirServerBase);
+ NarrativeModeEnum.NORMAL, statusCode, false, fhirServerBase, false);
// theResponse.setStatus(statusCode);
// theRequestDetails.getServer().addHeadersToResponse(theResponse);
diff --git a/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java b/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java
index d989d6aaa60..a204a42f37d 100644
--- a/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java
+++ b/hapi-fhir-jpaserver-example/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java
@@ -4,12 +4,11 @@ import java.util.List;
import javax.servlet.ServletException;
-import ca.uhn.fhir.context.FhirVersionEnum;
-
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu1;
import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2;
@@ -23,7 +22,7 @@ import ca.uhn.fhir.rest.server.EncodingEnum;
import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer;
-import ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor;
+import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
public class JpaServerDemo extends RestfulServer {
@@ -123,12 +122,12 @@ public class JpaServerDemo extends RestfulServer {
setPagingProvider(new FifoMemoryPagingProvider(10));
/*
- * Do some fancy logging to create a nice access log that has details about each incoming request.
+ * Load interceptors for the server from Spring (these are defined in hapi-fhir-server-config.xml
*/
- LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
- loggingInterceptor.setLoggerName("fhir.access");
- loggingInterceptor.setMessageFormat("Path[${servletPath}] Operation[${operationType} ${idOrResourceName}] UA[${requestHeader.user-agent}] Params[${requestParameters}]");
- this.registerInterceptor(loggingInterceptor);
+ List interceptorBeans = myAppCtx.getBean("myServerInterceptors", List.class);
+ for (IServerInterceptor interceptor : interceptorBeans) {
+ this.registerInterceptor(interceptor);
+ }
}
diff --git a/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/hapi-fhir-server-config.xml b/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/hapi-fhir-server-config.xml
index 3922d51ebb8..6b039d4bdf5 100644
--- a/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/hapi-fhir-server-config.xml
+++ b/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/hapi-fhir-server-config.xml
@@ -21,4 +21,18 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java
index 3976340b623..cd0686f8de5 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/SearchDstu2Test.java
@@ -1,6 +1,6 @@
package ca.uhn.fhir.rest.server;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import java.util.concurrent.TimeUnit;
@@ -49,6 +49,7 @@ public class SearchDstu2Test {
Patient patient = (Patient) ourCtx.newXmlParser().parseResource(Bundle.class, responseContent).getEntry().get(0).getResource();
String ref = patient.getManagingOrganization().getReference().getValue();
assertEquals("Organization/555", ref);
+ assertNull(status.getFirstHeader(Constants.HEADER_CONTENT_LOCATION));
}
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 157fa4f3e38..790b319d4f5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -136,6 +136,10 @@
Please let us know if this is a big hardship and we can find an alternate way
of making this change.
+
+ Prevent server from returning a Content-Location header for search
+ response when using the DSTU2 bundle format
+