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_CONNECTION_TTL, DEFAULT_POOL_MAX, DEFAULT_POOL_MAX_PER_ROUTE, DEFAULT_SERVER_VALIDATION_MODE, DEFAULT_SOCKET_TIMEOUT
-
Constructor Summary
ConstructorDescriptionConstructorRestfulClientFactory
(ca.uhn.fhir.context.FhirContext theFhirContext) Constructor -
Method Summary
Modifier and TypeMethodDescriptionint
int
int
ca.uhn.fhir.context.FhirContext
Return the fhir contextprotected abstract ca.uhn.fhir.rest.client.api.IHttpClient
getHttpClient
(String theServerBase) Get the http client for the given server baseint
int
protected String
Return the proxy password to authenticate with the HTTP proxyprotected String
Return the proxy username to authenticate with the HTTP proxyca.uhn.fhir.rest.client.api.ServerValidationModeEnum
ca.uhn.fhir.rest.client.api.ServerValidationModeEnum
Deprecated.int
<T extends ca.uhn.fhir.rest.client.api.IRestfulClient>
TInstantiates a new client instanceca.uhn.fhir.rest.client.api.IGenericClient
newGenericClient
(String theServerBase) protected abstract void
Reset the http client.void
setConnectionRequestTimeout
(int theConnectionRequestTimeout) void
setConnectionTimeToLive
(int theConnectionTimeToLive) void
setConnectTimeout
(int theConnectTimeout) void
setFhirContext
(ca.uhn.fhir.context.FhirContext theContext) Sets the context associated with this client factory.void
setPoolMaxPerRoute
(int thePoolMaxPerRoute) void
setPoolMaxTotal
(int thePoolMaxTotal) void
setProxyCredentials
(String theUsername, String thePassword) void
setServerValidationMode
(ca.uhn.fhir.rest.client.api.ServerValidationModeEnum theServerValidationMode) void
setServerValidationModeEnum
(ca.uhn.fhir.rest.client.api.ServerValidationModeEnum theServerValidationMode) Deprecated.void
setSocketTimeout
(int theSocketTimeout) protected void
Called automatically before the first use of this factory to ensure that the configuration is sane.void
validateServerBase
(String theServerBase, ca.uhn.fhir.rest.client.api.IHttpClient theHttpClient, ca.uhn.fhir.rest.client.api.IRestfulClient theClient) void
validateServerBaseIfConfiguredToDoSo
(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, wait
Methods 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:
getConnectionRequestTimeout
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getConnectTimeout
- Specified by:
getConnectTimeout
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getConnectionTimeToLive
- Specified by:
getConnectionTimeToLive
in 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:
setProxyCredentials
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getServerValidationMode
- Specified by:
getServerValidationMode
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getSocketTimeout
- Specified by:
getSocketTimeout
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getPoolMaxTotal
- Specified by:
getPoolMaxTotal
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getPoolMaxPerRoute
- Specified by:
getPoolMaxPerRoute
in 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:
newClient
in 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:
newGenericClient
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setConnectionRequestTimeout
- Specified by:
setConnectionRequestTimeout
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setConnectTimeout
- Specified by:
setConnectTimeout
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setConnectionTimeToLive
- Specified by:
setConnectionTimeToLive
in 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:
setServerValidationMode
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setSocketTimeout
- Specified by:
setSocketTimeout
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setPoolMaxTotal
- Specified by:
setPoolMaxTotal
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setPoolMaxPerRoute
- Specified by:
setPoolMaxPerRoute
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
getServerValidationModeEnum
@Deprecated public ca.uhn.fhir.rest.client.api.ServerValidationModeEnum getServerValidationModeEnum()Deprecated.- Specified by:
getServerValidationModeEnum
in interfaceca.uhn.fhir.rest.client.api.IRestfulClientFactory
-
setServerValidationModeEnum
@Deprecated public void setServerValidationModeEnum(ca.uhn.fhir.rest.client.api.ServerValidationModeEnum theServerValidationMode) Deprecated.- Specified by:
setServerValidationModeEnum
in 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:
validateServerBaseIfConfiguredToDoSo
in 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:
validateServerBase
in 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
-