diff --git a/examples/src/main/java/example/ClientExamples.java b/examples/src/main/java/example/ClientExamples.java index 5329092c9a2..3cde924cabc 100644 --- a/examples/src/main/java/example/ClientExamples.java +++ b/examples/src/main/java/example/ClientExamples.java @@ -1,18 +1,13 @@ package example; import org.hl7.fhir.dstu3.model.Bundle; -import org.hl7.fhir.instance.model.api.IBaseBundle; 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.*; import ca.uhn.fhir.rest.client.apache.GZipContentInterceptor; import ca.uhn.fhir.rest.client.api.IBasicClient; -import ca.uhn.fhir.rest.client.interceptor.BasicAuthInterceptor; -import ca.uhn.fhir.rest.client.interceptor.BearerTokenAuthInterceptor; -import ca.uhn.fhir.rest.client.interceptor.CookieInterceptor; -import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; +import ca.uhn.fhir.rest.client.interceptor.*; import ca.uhn.fhir.rest.server.EncodingEnum; public class ClientExamples { @@ -97,11 +92,12 @@ public class ClientExamples { // Create an HTTP basic auth interceptor String username = "foobar"; String password = "boobear"; + IClientInterceptor authInterceptor = new BasicAuthInterceptor(username, password); // If you're usinf an annotation client, use this style to // register it IPatientClient annotationClient = ctx.newRestfulClient(IPatientClient.class, "http://localhost:9999/fhir"); - annotationClient.registerInterceptor(authInterceptor); + annotationClient.registerInterceptor(authInterceptor); // If you're using a generic client, use this instead IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir");