Class RestfulClientFactory

  • All Implemented Interfaces:
    ca.uhn.fhir.rest.client.api.IRestfulClientFactory
    Direct Known Subclasses:
    ApacheRestfulClientFactory

    public abstract class RestfulClientFactory
    extends Object
    implements ca.uhn.fhir.rest.client.api.IRestfulClientFactory
    Base class for a REST client factory implementation
    • Constructor Detail

      • RestfulClientFactory

        public RestfulClientFactory​(ca.uhn.fhir.context.FhirContext theFhirContext)
        Constructor
        Parameters:
        theFhirContext - The context
    • Method Detail

      • getConnectionRequestTimeout

        public int getConnectionRequestTimeout()
        Specified by:
        getConnectionRequestTimeout in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • getConnectTimeout

        public int getConnectTimeout()
        Specified by:
        getConnectTimeout in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • getProxyUsername

        protected String getProxyUsername()
        Return the proxy username to authenticate with the HTTP proxy
      • getProxyPassword

        protected String getProxyPassword()
        Return the proxy password to authenticate with the HTTP proxy
      • setProxyCredentials

        public void setProxyCredentials​(String theUsername,
                                        String thePassword)
        Specified by:
        setProxyCredentials in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • getServerValidationMode

        public ca.uhn.fhir.rest.client.api.ServerValidationModeEnum getServerValidationMode()
        Specified by:
        getServerValidationMode in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • getSocketTimeout

        public int getSocketTimeout()
        Specified by:
        getSocketTimeout in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • getPoolMaxTotal

        public int getPoolMaxTotal()
        Specified by:
        getPoolMaxTotal in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • getPoolMaxPerRoute

        public int getPoolMaxPerRoute()
        Specified by:
        getPoolMaxPerRoute in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • newClient

        public <T extends ca.uhn.fhir.rest.client.api.IRestfulClient> T newClient​(Class<T> theClientType,
                                                                                  String theServerBase)
        Instantiates a new client instance
        Specified by:
        newClient in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
        Parameters:
        theClientType - The client type, which is an interface type to be instantiated
        theServerBase - The URL of the base for the restful FHIR server to connect to
        Returns:
        A newly created client
        Throws:
        ca.uhn.fhir.context.ConfigurationException - If the interface type is not an interface
      • validateConfigured

        protected void validateConfigured()
        Called automatically before the first use of this factory to ensure that the configuration is sane. Subclasses may override, but should also call super.validateConfigured()
      • newGenericClient

        public ca.uhn.fhir.rest.client.api.IGenericClient newGenericClient​(String theServerBase)
        Specified by:
        newGenericClient in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • setConnectionRequestTimeout

        public void setConnectionRequestTimeout​(int theConnectionRequestTimeout)
        Specified by:
        setConnectionRequestTimeout in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • setConnectTimeout

        public void setConnectTimeout​(int theConnectTimeout)
        Specified by:
        setConnectTimeout in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • setFhirContext

        public void setFhirContext​(ca.uhn.fhir.context.FhirContext theContext)
        Sets the context associated with this client factory. Must not be called more than once.
      • getFhirContext

        public ca.uhn.fhir.context.FhirContext getFhirContext()
        Return the fhir context
        Returns:
        the fhir context
      • setServerValidationMode

        public void setServerValidationMode​(ca.uhn.fhir.rest.client.api.ServerValidationModeEnum theServerValidationMode)
        Specified by:
        setServerValidationMode in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • setSocketTimeout

        public void setSocketTimeout​(int theSocketTimeout)
        Specified by:
        setSocketTimeout in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • setPoolMaxTotal

        public void setPoolMaxTotal​(int thePoolMaxTotal)
        Specified by:
        setPoolMaxTotal in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • setPoolMaxPerRoute

        public void setPoolMaxPerRoute​(int thePoolMaxPerRoute)
        Specified by:
        setPoolMaxPerRoute in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • getServerValidationModeEnum

        @Deprecated
        public ca.uhn.fhir.rest.client.api.ServerValidationModeEnum getServerValidationModeEnum()
        Deprecated.
        Specified by:
        getServerValidationModeEnum in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • setServerValidationModeEnum

        @Deprecated
        public void setServerValidationModeEnum​(ca.uhn.fhir.rest.client.api.ServerValidationModeEnum theServerValidationMode)
        Deprecated.
        Specified by:
        setServerValidationModeEnum in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • validateServerBaseIfConfiguredToDoSo

        public void validateServerBaseIfConfiguredToDoSo​(String theServerBase,
                                                         ca.uhn.fhir.rest.client.api.IHttpClient theHttpClient,
                                                         ca.uhn.fhir.rest.client.api.IRestfulClient theClient)
        Specified by:
        validateServerBaseIfConfiguredToDoSo in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • validateServerBase

        public void validateServerBase​(String theServerBase,
                                       ca.uhn.fhir.rest.client.api.IHttpClient theHttpClient,
                                       ca.uhn.fhir.rest.client.api.IRestfulClient theClient)
        Specified by:
        validateServerBase in interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
      • getHttpClient

        protected abstract ca.uhn.fhir.rest.client.api.IHttpClient getHttpClient​(String theServerBase)
        Get the http client for the given server base
        Parameters:
        theServerBase - the server base
        Returns:
        the http client
      • resetHttpClient

        protected abstract void resetHttpClient()
        Reset the http client. This method is used when parameters have been set and a new http client needs to be created