Package ca.uhn.fhir.rest.client.impl
Class RestfulClientFactory
java.lang.Object
ca.uhn.fhir.rest.client.impl.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
-
Field Summary
Fields inherited from interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
DEFAULT_CONNECT_TIMEOUT, DEFAULT_CONNECTION_REQUEST_TIMEOUT, DEFAULT_POOL_MAX, DEFAULT_POOL_MAX_PER_ROUTE, DEFAULT_SERVER_VALIDATION_MODE, DEFAULT_SOCKET_TIMEOUT -
Constructor Summary
ConstructorsConstructorDescriptionConstructorRestfulClientFactory(ca.uhn.fhir.context.FhirContext theFhirContext)Constructor -
Method Summary
Modifier and TypeMethodDescriptionintintca.uhn.fhir.context.FhirContextReturn the fhir contextprotected abstract ca.uhn.fhir.rest.client.api.IHttpClientgetHttpClient(String theServerBase)Get the http client for the given server baseintintprotected StringReturn the proxy password to authenticate with the HTTP proxyprotected StringReturn the proxy username to authenticate with the HTTP proxyca.uhn.fhir.rest.client.api.ServerValidationModeEnumca.uhn.fhir.rest.client.api.ServerValidationModeEnumDeprecated.int<T extends ca.uhn.fhir.rest.client.api.IRestfulClient>
TInstantiates a new client instanceca.uhn.fhir.rest.client.api.IGenericClientnewGenericClient(String theServerBase)protected abstract voidReset the http client.voidsetConnectionRequestTimeout(int theConnectionRequestTimeout)voidsetConnectTimeout(int theConnectTimeout)voidsetFhirContext(ca.uhn.fhir.context.FhirContext theContext)Sets the context associated with this client factory.voidsetPoolMaxPerRoute(int thePoolMaxPerRoute)voidsetPoolMaxTotal(int thePoolMaxTotal)voidsetProxyCredentials(String theUsername, String thePassword)voidsetServerValidationMode(ca.uhn.fhir.rest.client.api.ServerValidationModeEnum theServerValidationMode)voidsetServerValidationModeEnum(ca.uhn.fhir.rest.client.api.ServerValidationModeEnum theServerValidationMode)Deprecated.voidsetSocketTimeout(int theSocketTimeout)protected voidCalled automatically before the first use of this factory to ensure that the configuration is sane.voidvalidateServerBase(String theServerBase, ca.uhn.fhir.rest.client.api.IHttpClient theHttpClient, ca.uhn.fhir.rest.client.api.IRestfulClient theClient)voidvalidateServerBaseIfConfiguredToDoSo(String theServerBase, ca.uhn.fhir.rest.client.api.IHttpClient theHttpClient, ca.uhn.fhir.rest.client.api.IRestfulClient theClient)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ca.uhn.fhir.rest.client.api.IRestfulClientFactory
getHttpClient, setHttpClient, setProxy
-
Constructor Details
-
RestfulClientFactory
public RestfulClientFactory()Constructor -
RestfulClientFactory
Constructor- Parameters:
theFhirContext- The context
-
-
Method Details
-
getConnectionRequestTimeout
- Specified by:
getConnectionRequestTimeoutin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getConnectTimeout
- Specified by:
getConnectTimeoutin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getProxyUsername
Return the proxy username to authenticate with the HTTP proxy -
getProxyPassword
Return the proxy password to authenticate with the HTTP proxy -
setProxyCredentials
- Specified by:
setProxyCredentialsin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getServerValidationMode
- Specified by:
getServerValidationModein interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getSocketTimeout
- Specified by:
getSocketTimeoutin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getPoolMaxTotal
- Specified by:
getPoolMaxTotalin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getPoolMaxPerRoute
- Specified by:
getPoolMaxPerRoutein interfaceca.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:
newClientin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory- Parameters:
theClientType- The client type, which is an interface type to be instantiatedtheServerBase- 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
Called automatically before the first use of this factory to ensure that the configuration is sane. Subclasses may override, but should also callsuper.validateConfigured() -
newGenericClient
- Specified by:
newGenericClientin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setConnectionRequestTimeout
- Specified by:
setConnectionRequestTimeoutin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setConnectTimeout
- Specified by:
setConnectTimeoutin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setFhirContext
Sets the context associated with this client factory. Must not be called more than once. -
getFhirContext
Return the fhir context- Returns:
- the fhir context
-
setServerValidationMode
public void setServerValidationMode(ca.uhn.fhir.rest.client.api.ServerValidationModeEnum theServerValidationMode)- Specified by:
setServerValidationModein interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setSocketTimeout
- Specified by:
setSocketTimeoutin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setPoolMaxTotal
- Specified by:
setPoolMaxTotalin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setPoolMaxPerRoute
- Specified by:
setPoolMaxPerRoutein interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getServerValidationModeEnum
@Deprecated public ca.uhn.fhir.rest.client.api.ServerValidationModeEnum getServerValidationModeEnum()Deprecated.- Specified by:
getServerValidationModeEnumin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setServerValidationModeEnum
@Deprecated public void setServerValidationModeEnum(ca.uhn.fhir.rest.client.api.ServerValidationModeEnum theServerValidationMode)Deprecated.- Specified by:
setServerValidationModeEnumin interfaceca.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:
validateServerBaseIfConfiguredToDoSoin interfaceca.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:
validateServerBasein interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getHttpClient
Get the http client for the given server base- Parameters:
theServerBase- the server base- Returns:
- the http client
-
resetHttpClient
Reset the http client. This method is used when parameters have been set and a new http client needs to be created
-