diff --git a/examples/pom.xml b/examples/pom.xml index 3ddf11d628c..83e5707eb97 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -40,6 +40,11 @@ hapi-fhir-validation-resources-dstu2 2.1-SNAPSHOT + + ca.uhn.hapi.fhir + hapi-fhir-client-okhttp + 2.1-SNAPSHOT + ca.uhn.hapi.fhir hapi-fhir-jaxrsserver-base diff --git a/examples/src/main/java/example/ClientExamples.java b/examples/src/main/java/example/ClientExamples.java index e36a8139fc9..1d6a708792a 100644 --- a/examples/src/main/java/example/ClientExamples.java +++ b/examples/src/main/java/example/ClientExamples.java @@ -1,6 +1,7 @@ package example; import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.okhttp.client.OkHttpRestfulClientFactory; import ca.uhn.fhir.rest.client.IGenericClient; import ca.uhn.fhir.rest.client.IRestfulClientFactory; import ca.uhn.fhir.rest.client.apache.GZipContentInterceptor; @@ -34,6 +35,19 @@ public class ClientExamples { // END SNIPPET: proxy } + @SuppressWarnings("unused") + public void createOkHttp() { + // START SNIPPET: okhttp + FhirContext ctx = FhirContext.forDstu3(); + + // Use OkHttp + ctx.setRestfulClientFactory(new OkHttpRestfulClientFactory(ctx)); + + // Create the client + IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir"); + // END SNIPPET: okhttp + } + @SuppressWarnings("unused") public void createTimeouts() { // START SNIPPET: timeouts diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml index cf20cd40389..e3b6f9c1327 100644 --- a/hapi-fhir-android/pom.xml +++ b/hapi-fhir-android/pom.xml @@ -60,6 +60,11 @@ hapi-fhir-client-okhttp 2.1-SNAPSHOT + + commons-codec + commons-codec + test + org.codehaus.woodstox diff --git a/pom.xml b/pom.xml index a82cec952f7..f8ec2c54bfe 100644 --- a/pom.xml +++ b/pom.xml @@ -269,9 +269,6 @@ yyyy-MM-dd'T'HH:mm:ss'Z' - - 1.4 - UTF-8 diff --git a/src/site/xdoc/doc_android.xml.vm b/src/site/xdoc/doc_android.xml.vm index b1db0b105fe..97679ac4f44 100644 --- a/src/site/xdoc/doc_android.xml.vm +++ b/src/site/xdoc/doc_android.xml.vm @@ -69,6 +69,21 @@

+
+ +

+ The following is intended to be a selection of publicly available open source + Android applications which use HAPI FHIR and might be useful as a reference. +

+

+ If you know of others, please let us know! +

+ + +
+ diff --git a/src/site/xdoc/doc_rest_client_http_config.xml b/src/site/xdoc/doc_rest_client_http_config.xml.vm similarity index 68% rename from src/site/xdoc/doc_rest_client_http_config.xml rename to src/site/xdoc/doc_rest_client_http_config.xml.vm index 10247b25523..25965bd4e3f 100644 --- a/src/site/xdoc/doc_rest_client_http_config.xml +++ b/src/site/xdoc/doc_rest_client_http_config.xml.vm @@ -51,8 +51,8 @@

While this process is not particularly significant on reasonably - performant machines (current benchmarks show that this takes - roughly 6 seconds on one developer workstation), on some devices + performant machines (one benchmark showed that this takes + roughly 0.6 seconds to scan all types on one developer workstation), on some devices (e.g. Android phones where every millisecond counts) it may be desirable to defer this scan.

@@ -74,11 +74,16 @@
- +

RESTful clients (both Generic and Annotation-Driven) use Apache HTTP Client - as a provider. The Apache HTTP Client is very powerful and extremely + as a provider by default (except on Android, where + OkHttp + is the default). +

+

+ The Apache HTTP Client is very powerful and extremely flexible, but can be confusing at first to configure, because of the low-level approach that @@ -135,6 +140,49 @@ + + +

+ As of HAPI FHIR 2.0, an alternate client implementation + is available. This client replaces the low-level + Apache HttpClient implementation with the + Square + OkHttp + library. +

+

+ Changing HTTP implementations should be mostly + transparent (it has no effect on the actual FHIR + semantics which are transmitted over the wire) but + might be useful if you have an application that + uses OkHttp in other parts of the application and + has specific configuration for that library. +

+

+ Note that as of HAPI FHIR 2.1, OkHttp is the default + provider on Android, and will be used without any + configuration being required. This is done because + HttpClient is deprecated on Android and has caused + problems in the past. +

+

+ To use OkHttp, first add the library as a dependency to your project POM: +

+ + ca.uhn.hapi.fhir + hapi-fhir-client-okhttp + ${hapi_stable_version} +]]> + +

+ Then, set the client factory to use OkHttp. +

+ + + + +
diff --git a/src/site/xdoc/download.xml.vm b/src/site/xdoc/download.xml.vm index 01dc457fe04..6a52416559a 100644 --- a/src/site/xdoc/download.xml.vm +++ b/src/site/xdoc/download.xml.vm @@ -123,12 +123,12 @@ ca.uhn.hapi.fhir hapi-fhir-base - ${hapi_stable_version} + ${project.version}
ca.uhn.hapi.fhir hapi-fhir-structures-dstu - ${hapi_stable_version} + ${project.version} ]]> @@ -151,7 +151,7 @@ ca.uhn.hapi.fhir hapi-fhir-structures-dstu2 - ${hapi_stable_version} + ${project.version} ]]> @@ -166,7 +166,7 @@ ca.uhn.hapi.fhir hapi-fhir-structures-hl7org-dstu2 - ${hapi_stable_version} + ${project.version} ]]>

@@ -177,7 +177,7 @@ ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu2 - ${hapi_stable_version} + ${project.version} ]]> @@ -193,19 +193,19 @@

DSTU1:

- +

DSTU2 (HAPI):

- +

DSTU2 (RI):

- +