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
-
-
Constructor Summary
Constructors Constructor Description RestfulClientFactory()ConstructorRestfulClientFactory(ca.uhn.fhir.context.FhirContext theFhirContext)Constructor
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intgetConnectionRequestTimeout()intgetConnectTimeout()ca.uhn.fhir.context.FhirContextgetFhirContext()Return the fhir contextprotected abstract ca.uhn.fhir.rest.client.api.IHttpClientgetHttpClient(String theServerBase)Get the http client for the given server baseintgetPoolMaxPerRoute()intgetPoolMaxTotal()protected StringgetProxyPassword()Return the proxy password to authenticate with the HTTP proxyprotected StringgetProxyUsername()Return the proxy username to authenticate with the HTTP proxyca.uhn.fhir.rest.client.api.ServerValidationModeEnumgetServerValidationMode()ca.uhn.fhir.rest.client.api.ServerValidationModeEnumgetServerValidationModeEnum()Deprecated.intgetSocketTimeout()<T extends ca.uhn.fhir.rest.client.api.IRestfulClient>
TnewClient(Class<T> theClientType, String theServerBase)Instantiates a new client instanceca.uhn.fhir.rest.client.api.IGenericClientnewGenericClient(String theServerBase)protected abstract voidresetHttpClient()Reset 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 voidvalidateConfigured()Called 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)
-
-
-
Constructor Detail
-
RestfulClientFactory
public RestfulClientFactory()
Constructor
-
RestfulClientFactory
public RestfulClientFactory(ca.uhn.fhir.context.FhirContext theFhirContext)
Constructor- Parameters:
theFhirContext- The context
-
-
Method Detail
-
getConnectionRequestTimeout
public int getConnectionRequestTimeout()
- Specified by:
getConnectionRequestTimeoutin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getConnectTimeout
public int getConnectTimeout()
- Specified by:
getConnectTimeoutin interfaceca.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:
setProxyCredentialsin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getServerValidationMode
public ca.uhn.fhir.rest.client.api.ServerValidationModeEnum getServerValidationMode()
- Specified by:
getServerValidationModein interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getSocketTimeout
public int getSocketTimeout()
- Specified by:
getSocketTimeoutin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getPoolMaxTotal
public int getPoolMaxTotal()
- Specified by:
getPoolMaxTotalin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getPoolMaxPerRoute
public int 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
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 callsuper.validateConfigured()
-
newGenericClient
public ca.uhn.fhir.rest.client.api.IGenericClient newGenericClient(String theServerBase)
- Specified by:
newGenericClientin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setConnectionRequestTimeout
public void setConnectionRequestTimeout(int theConnectionRequestTimeout)
- Specified by:
setConnectionRequestTimeoutin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setConnectTimeout
public void setConnectTimeout(int theConnectTimeout)
- Specified by:
setConnectTimeoutin interfaceca.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:
setServerValidationModein interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setSocketTimeout
public void setSocketTimeout(int theSocketTimeout)
- Specified by:
setSocketTimeoutin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setPoolMaxTotal
public void setPoolMaxTotal(int thePoolMaxTotal)
- Specified by:
setPoolMaxTotalin interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setPoolMaxPerRoute
public void setPoolMaxPerRoute(int thePoolMaxPerRoute)
- 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
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
-
-