Class BaseClient

java.lang.Object
ca.uhn.fhir.rest.client.impl.BaseClient
All Implemented Interfaces:
ca.uhn.fhir.rest.client.api.IRestfulClient
Direct Known Subclasses:
ClientInvocationHandler, GenericClient

public abstract class BaseClient extends Object implements ca.uhn.fhir.rest.client.api.IRestfulClient
  • Field Details

    • HAPI_CLIENT_KEEPRESPONSES

      public static final String HAPI_CLIENT_KEEPRESPONSES
      This property is used by unit tests - do not rely on it in production code as it may change at any time. If you want to capture responses in a reliable way in your own code, just use client interceptors
      See Also:
      Constant Field Values
  • Method Details

    • getInterceptorService

      public ca.uhn.fhir.interceptor.api.IInterceptorService getInterceptorService()
      Specified by:
      getInterceptorService in interface ca.uhn.fhir.rest.client.api.IRestfulClient
    • setInterceptorService

      public void setInterceptorService(@Nonnull ca.uhn.fhir.interceptor.api.IInterceptorService theInterceptorService)
      Specified by:
      setInterceptorService in interface ca.uhn.fhir.rest.client.api.IRestfulClient
    • createExtraParams

      protected Map<String,​List<String>> createExtraParams(String theCustomAcceptHeader)
    • fetchResourceFromUrl

      public <T extends org.hl7.fhir.instance.model.api.IBaseResource> T fetchResourceFromUrl(Class<T> theResourceType, String theUrl)
      Specified by:
      fetchResourceFromUrl in interface ca.uhn.fhir.rest.client.api.IRestfulClient
    • getEncoding

      public ca.uhn.fhir.rest.api.EncodingEnum getEncoding()
      Specified by:
      getEncoding in interface ca.uhn.fhir.rest.client.api.IRestfulClient
    • setEncoding

      public void setEncoding(ca.uhn.fhir.rest.api.EncodingEnum theEncoding)
      Sets the encoding that will be used on requests. Default is null, which means the client will not explicitly request an encoding. (This is perfectly acceptable behaviour according to the FHIR specification. In this case, the server will choose which encoding to return, and the client can handle either XML or JSON)
      Specified by:
      setEncoding in interface ca.uhn.fhir.rest.client.api.IRestfulClient
    • getHttpClient

      public ca.uhn.fhir.rest.client.api.IHttpClient getHttpClient()
      Specified by:
      getHttpClient in interface ca.uhn.fhir.rest.client.api.IRestfulClient
    • getLastResponse

      public ca.uhn.fhir.rest.client.api.IHttpResponse getLastResponse()
      For now, this is a part of the internal API of HAPI - Use with caution as this method may change!
    • getLastResponseBody

      For now, this is a part of the internal API of HAPI - Use with caution as this method may change!
    • getServerBase

      Specified by:
      getServerBase in interface ca.uhn.fhir.rest.client.api.IRestfulClient
    • getSummary

      public ca.uhn.fhir.rest.api.SummaryEnum getSummary()
    • setSummary

      public void setSummary(ca.uhn.fhir.rest.api.SummaryEnum theSummary)
      Specified by:
      setSummary in interface ca.uhn.fhir.rest.client.api.IRestfulClient
    • getUrlBase

      public String getUrlBase()
    • setFormatParamStyle

      public void setFormatParamStyle(ca.uhn.fhir.rest.api.RequestFormatParamStyleEnum theRequestFormatParamStyle)
      Specified by:
      setFormatParamStyle in interface ca.uhn.fhir.rest.client.api.IRestfulClient
    • invokeClient

      protected <T> T invokeClient(ca.uhn.fhir.context.FhirContext theContext, IClientResponseHandler<T> binding, BaseHttpClientInvocation clientInvocation)
    • invokeClient

      protected <T> T invokeClient(ca.uhn.fhir.context.FhirContext theContext, IClientResponseHandler<T> binding, BaseHttpClientInvocation clientInvocation, boolean theLogRequestAndResponse)
    • invokeClient

      protected <T> T invokeClient(ca.uhn.fhir.context.FhirContext theContext, IClientResponseHandler<T> binding, BaseHttpClientInvocation clientInvocation, ca.uhn.fhir.rest.api.EncodingEnum theEncoding, Boolean thePrettyPrint, boolean theLogRequestAndResponse, ca.uhn.fhir.rest.api.SummaryEnum theSummaryMode, Set<String> theSubsetElements, ca.uhn.fhir.rest.api.CacheControlDirective theCacheControlDirective, String theCustomAcceptHeader, Map<String,​List<String>> theCustomHeaders)
    • isKeepResponses

      public boolean isKeepResponses()
      For now, this is a part of the internal API of HAPI - Use with caution as this method may change!
    • setKeepResponses

      public void setKeepResponses(boolean theKeepResponses)
      For now, this is a part of the internal API of HAPI - Use with caution as this method may change!
    • isPrettyPrint

      public boolean isPrettyPrint()
      Returns the pretty print flag, which is a request to the server for it to return "pretty printed" responses. Note that this is currently a non-standard flag (_pretty) which is supported only by HAPI based servers (and any other servers which might implement it).
    • setPrettyPrint

      public void setPrettyPrint(Boolean thePrettyPrint)
      Sets the pretty print flag, which is a request to the server for it to return "pretty printed" responses. Note that this is currently a non-standard flag (_pretty) which is supported only by HAPI based servers (and any other servers which might implement it).
      Specified by:
      setPrettyPrint in interface ca.uhn.fhir.rest.client.api.IRestfulClient
    • registerInterceptor

      public void registerInterceptor(Object theInterceptor)
      Specified by:
      registerInterceptor in interface ca.uhn.fhir.rest.client.api.IRestfulClient
    • setDontValidateConformance

      public void setDontValidateConformance(boolean theDontValidateConformance)
      This method is an internal part of the HAPI API and may change, use with caution. If you want to disable the loading of conformance statements, use IRestfulClientFactory.setServerValidationMode(ServerValidationModeEnum)
    • unregisterInterceptor

      public void unregisterInterceptor(Object theInterceptor)
      Specified by:
      unregisterInterceptor in interface ca.uhn.fhir.rest.client.api.IRestfulClient