Interface IRestfulClientFactory
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Default value forgetConnectTimeout()
static final int
Default value forgetConnectionRequestTimeout()
static final int
Default value forgetConnectionTimeToLive()
static final int
Default value for()
static final int
Default value forgetPoolMaxPerRoute()
static final ServerValidationModeEnum
Default value forgetServerValidationModeEnum()
static final int
Default value forgetSocketTimeout()
-
Method Summary
Modifier and TypeMethodDescriptionint
Gets the connection request timeout, in milliseconds.default int
Gets the connection time to live, in milliseconds.int
Gets the connect timeout, in milliseconds.getHttpClient
(StringBuilder theUrl, Map<String, List<String>> theIfNoneExistParams, String theIfNoneExistString, RequestTypeEnum theRequestType, List<Header> theHeaders) Returns the HTTP client instance.int
Gets the maximum number of connections per route allowed in the pool.int
Gets the maximum number of connections allowed in the pool.Gets the server validation mode for any clients created from this factory.Deprecated.int
Gets the socket timeout, in milliseconds.<T extends IRestfulClient>
TInstantiates a new client instancenewGenericClient
(String theServerBase) Instantiates a new generic client instancevoid
setConnectionRequestTimeout
(int theConnectionRequestTimeout) Sets the connection request timeout, in milliseconds.default void
setConnectionTimeToLive
(int theConnectionTimeToLive) Sets the connection time to live, in milliseconds.void
setConnectTimeout
(int theConnectTimeout) Sets the connect timeout, in milliseconds.<T> void
setHttpClient
(T theHttpClient) Sets the Apache HTTP client instance to be used by any new restful clients created by this factory.void
setPoolMaxPerRoute
(int thePoolMaxPerRoute) Sets the maximum number of connections per route allowed in the pool.void
setPoolMaxTotal
(int thePoolMaxTotal) Sets the maximum number of connections allowed in the pool.void
Sets the HTTP proxy to use for outgoing connectionsvoid
setProxyCredentials
(String theUsername, String thePassword) Sets the credentials to use to authenticate with the HTTP proxy, if one is defined.void
setServerValidationMode
(ServerValidationModeEnum theServerValidationMode) Sets the server validation mode for any clients created from this factory.void
setServerValidationModeEnum
(ServerValidationModeEnum theServerValidationMode) Deprecated.UsesetServerValidationMode(ServerValidationModeEnum)
instead.void
setSocketTimeout
(int theSocketTimeout) Sets the socket timeout, in milliseconds.void
validateServerBase
(String theServerBase, IHttpClient theHttpClient, IRestfulClient theClient) void
validateServerBaseIfConfiguredToDoSo
(String theServerBase, IHttpClient theHttpClient, IRestfulClient theClient) This method is internal to HAPI - It may change in future versions, use with caution.
-
Field Details
-
DEFAULT_CONNECT_TIMEOUT
Default value forgetConnectTimeout()
- See Also:
-
DEFAULT_CONNECTION_REQUEST_TIMEOUT
Default value forgetConnectionRequestTimeout()
- See Also:
-
DEFAULT_CONNECTION_TTL
Default value forgetConnectionTimeToLive()
- See Also:
-
DEFAULT_SERVER_VALIDATION_MODE
Default value forgetServerValidationModeEnum()
-
DEFAULT_SOCKET_TIMEOUT
Default value forgetSocketTimeout()
- See Also:
-
DEFAULT_POOL_MAX
Default value for()
- See Also:
-
DEFAULT_POOL_MAX_PER_ROUTE
Default value forgetPoolMaxPerRoute()
- See Also:
-
-
Method Details
-
getConnectionRequestTimeout
Gets the connection request timeout, in milliseconds. This is the amount of time that the HTTPClient connection pool may wait for an available connection before failing. This setting typically does not need to be adjusted.The default value for this setting is defined by
DEFAULT_CONNECTION_REQUEST_TIMEOUT
-
getConnectTimeout
int getConnectTimeout()Gets the connect timeout, in milliseconds. This is the amount of time that the initial connection attempt network operation may block without failing.The default value for this setting is defined by
DEFAULT_CONNECT_TIMEOUT
-
getConnectionTimeToLive
Gets the connection time to live, in milliseconds. This is the amount of time to keep connections alive for reuse.The default value for this setting is defined by
DEFAULT_CONNECTION_TTL
-
getHttpClient
IHttpClient getHttpClient(StringBuilder theUrl, Map<String, List<String>> theIfNoneExistParams, String theIfNoneExistString, RequestTypeEnum theRequestType, List<Header> theHeaders) Returns the HTTP client instance. This method will not return null.- Parameters:
theUrl
- The complete FHIR url to which the http request will be senttheIfNoneExistParams
- The params for header "If-None-Exist" as a hashmaptheIfNoneExistString
- The param for header "If-None-Exist" as a stringtheRequestType
- the type of HTTP request (GET, DELETE, ..)theHeaders
- the headers to be sent together with the http request- Returns:
- the HTTP client instance
-
getServerValidationModeEnum
Deprecated.UsegetServerValidationMode()
instead (this method is a synonym for that method, but this method is poorly named and will be removed at some point) -
getServerValidationMode
Gets the server validation mode for any clients created from this factory. Server validation involves the client requesting the server's conformance statement to determine whether the server is appropriate for the given client.The default value for this setting is defined by
DEFAULT_SERVER_VALIDATION_MODE
- Since:
- 1.0
-
getSocketTimeout
int getSocketTimeout()Gets the socket timeout, in milliseconds. This is the SO_TIMEOUT time, which is the amount of time that a read/write network operation may block without failing.The default value for this setting is defined by
DEFAULT_SOCKET_TIMEOUT
-
getPoolMaxTotal
int getPoolMaxTotal()Gets the maximum number of connections allowed in the pool.The default value for this setting is defined by
DEFAULT_POOL_MAX
-
getPoolMaxPerRoute
int getPoolMaxPerRoute()Gets the maximum number of connections per route allowed in the pool.The default value for this setting is defined by
DEFAULT_POOL_MAX_PER_ROUTE
-
newClient
Instantiates a new client instance- 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:
ConfigurationException
- If the interface type is not an interface
-
newGenericClient
Instantiates a new generic client instance- Parameters:
theServerBase
- The URL of the base for the restful FHIR server to connect to- Returns:
- A newly created client
-
setConnectionRequestTimeout
Sets the connection request timeout, in milliseconds. This is the amount of time that the HTTPClient connection pool may wait for an available connection before failing. This setting typically does not need to be adjusted.The default value for this setting is defined by
DEFAULT_CONNECTION_REQUEST_TIMEOUT
-
setConnectTimeout
Sets the connect timeout, in milliseconds. This is the amount of time that the initial connection attempt network operation may block without failing.The default value for this setting is defined by
DEFAULT_CONNECT_TIMEOUT
-
setConnectionTimeToLive
Sets the connection time to live, in milliseconds. This is the amount of time to keep connections alive for reuse.The default value for this setting is defined by
DEFAULT_CONNECTION_TTL
-
setHttpClient
Sets the Apache HTTP client instance to be used by any new restful clients created by this factory. If set tonull
, a new HTTP client with default settings will be created.- Parameters:
theHttpClient
- An HTTP client instance to use, ornull
-
setProxy
Sets the HTTP proxy to use for outgoing connections- Parameters:
theHost
- The host (or null to disable proxying, as is the default)thePort
- The port (or null to disable proxying, as is the default)
-
setProxyCredentials
Sets the credentials to use to authenticate with the HTTP proxy, if one is defined. Set to null to use no authentication with the proxy.- Parameters:
theUsername
- The usernamethePassword
- The password
-
setServerValidationModeEnum
Deprecated.UsesetServerValidationMode(ServerValidationModeEnum)
instead. This method was incorrectly named. -
setServerValidationMode
Sets the server validation mode for any clients created from this factory. Server validation involves the client requesting the server's conformance statement to determine whether the server is appropriate for the given client.This check is primarily to validate that the server supports an appropriate version of FHIR
The default value for this setting is defined by
DEFAULT_SERVER_VALIDATION_MODE
- Since:
- 1.0
-
setSocketTimeout
Sets the socket timeout, in milliseconds. This is the SO_TIMEOUT time, which is the amount of time that a read/write network operation may block without failing.The default value for this setting is defined by
DEFAULT_SOCKET_TIMEOUT
-
setPoolMaxTotal
Sets the maximum number of connections allowed in the pool.The default value for this setting is defined by
DEFAULT_POOL_MAX
-
setPoolMaxPerRoute
Sets the maximum number of connections per route allowed in the pool.The default value for this setting is defined by
DEFAULT_POOL_MAX_PER_ROUTE
-
validateServerBase
-
validateServerBaseIfConfiguredToDoSo
void validateServerBaseIfConfiguredToDoSo(String theServerBase, IHttpClient theHttpClient, IRestfulClient theClient) This method is internal to HAPI - It may change in future versions, use with caution.
-
getServerValidationMode()
instead (this method is a synonym for that method, but this method is poorly named and will be removed at some point)