Interface IRestfulClientFactory
-
public interface IRestfulClientFactory
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_CONNECT_TIMEOUTDefault value forgetConnectTimeout()static intDEFAULT_CONNECTION_REQUEST_TIMEOUTDefault value forgetConnectionRequestTimeout()static intDEFAULT_POOL_MAXDefault value for()static intDEFAULT_POOL_MAX_PER_ROUTEDefault value forgetPoolMaxPerRoute()static ServerValidationModeEnumDEFAULT_SERVER_VALIDATION_MODEDefault value forgetServerValidationModeEnum()static intDEFAULT_SOCKET_TIMEOUTDefault value forgetSocketTimeout()
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description intgetConnectionRequestTimeout()Gets the connection request timeout, in milliseconds.intgetConnectTimeout()Gets the connect timeout, in milliseconds.IHttpClientgetHttpClient(StringBuilder theUrl, Map<String,List<String>> theIfNoneExistParams, String theIfNoneExistString, RequestTypeEnum theRequestType, List<Header> theHeaders)Returns the HTTP client instance.intgetPoolMaxPerRoute()Gets the maximum number of connections per route allowed in the pool.intgetPoolMaxTotal()Gets the maximum number of connections allowed in the pool.ServerValidationModeEnumgetServerValidationMode()Gets the server validation mode for any clients created from this factory.ServerValidationModeEnumgetServerValidationModeEnum()Deprecated.UsegetServerValidationMode()instead (this method is a synonym for that method, but this method is poorly named and will be removed at some point)intgetSocketTimeout()Gets the socket timeout, in milliseconds.<T extends IRestfulClient>
TnewClient(Class<T> theClientType, String theServerBase)Instantiates a new client instanceIGenericClientnewGenericClient(String theServerBase)Instantiates a new generic client instancevoidsetConnectionRequestTimeout(int theConnectionRequestTimeout)Sets the connection request timeout, in milliseconds.voidsetConnectTimeout(int theConnectTimeout)Sets the connect timeout, in milliseconds.<T> voidsetHttpClient(T theHttpClient)Sets the Apache HTTP client instance to be used by any new restful clients created by this factory.voidsetPoolMaxPerRoute(int thePoolMaxPerRoute)Sets the maximum number of connections per route allowed in the pool.voidsetPoolMaxTotal(int thePoolMaxTotal)Sets the maximum number of connections allowed in the pool.voidsetProxy(String theHost, Integer thePort)Sets the HTTP proxy to use for outgoing connectionsvoidsetProxyCredentials(String theUsername, String thePassword)Sets the credentials to use to authenticate with the HTTP proxy, if one is defined.voidsetServerValidationMode(ServerValidationModeEnum theServerValidationMode)Sets the server validation mode for any clients created from this factory.voidsetServerValidationModeEnum(ServerValidationModeEnum theServerValidationMode)Deprecated.UsesetServerValidationMode(ServerValidationModeEnum)instead.voidsetSocketTimeout(int theSocketTimeout)Sets the socket timeout, in milliseconds.voidvalidateServerBase(String theServerBase, IHttpClient theHttpClient, IRestfulClient theClient)voidvalidateServerBaseIfConfiguredToDoSo(String theServerBase, IHttpClient theHttpClient, IRestfulClient theClient)This method is internal to HAPI - It may change in future versions, use with caution.
-
-
-
Field Detail
-
DEFAULT_CONNECT_TIMEOUT
static final int DEFAULT_CONNECT_TIMEOUT
Default value forgetConnectTimeout()- See Also:
- Constant Field Values
-
DEFAULT_CONNECTION_REQUEST_TIMEOUT
static final int DEFAULT_CONNECTION_REQUEST_TIMEOUT
Default value forgetConnectionRequestTimeout()- See Also:
- Constant Field Values
-
DEFAULT_SERVER_VALIDATION_MODE
static final ServerValidationModeEnum DEFAULT_SERVER_VALIDATION_MODE
Default value forgetServerValidationModeEnum()
-
DEFAULT_SOCKET_TIMEOUT
static final int DEFAULT_SOCKET_TIMEOUT
Default value forgetSocketTimeout()- See Also:
- Constant Field Values
-
DEFAULT_POOL_MAX
static final int DEFAULT_POOL_MAX
Default value for()- See Also:
- Constant Field Values
-
DEFAULT_POOL_MAX_PER_ROUTE
static final int DEFAULT_POOL_MAX_PER_ROUTE
Default value forgetPoolMaxPerRoute()- See Also:
- Constant Field Values
-
-
Method Detail
-
getConnectionRequestTimeout
int 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
-
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 ServerValidationModeEnum 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
ServerValidationModeEnum 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
<T extends IRestfulClient> T newClient(Class<T> theClientType, String theServerBase)
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
IGenericClient newGenericClient(String theServerBase)
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
void setConnectionRequestTimeout(int theConnectionRequestTimeout)
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
void setConnectTimeout(int theConnectTimeout)
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
-
setHttpClient
<T> void setHttpClient(T theHttpClient)
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
void setProxy(String theHost, Integer thePort)
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
void setProxyCredentials(String theUsername, String thePassword)
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 void setServerValidationModeEnum(ServerValidationModeEnum theServerValidationMode)
Deprecated.UsesetServerValidationMode(ServerValidationModeEnum)instead. This method was incorrectly named.
-
setServerValidationMode
void setServerValidationMode(ServerValidationModeEnum theServerValidationMode)
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
void setSocketTimeout(int theSocketTimeout)
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
void setPoolMaxTotal(int thePoolMaxTotal)
Sets the maximum number of connections allowed in the pool.The default value for this setting is defined by
DEFAULT_POOL_MAX
-
setPoolMaxPerRoute
void setPoolMaxPerRoute(int thePoolMaxPerRoute)
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
void validateServerBase(String theServerBase, IHttpClient theHttpClient, IRestfulClient theClient)
-
validateServerBaseIfConfiguredToDoSo
void validateServerBaseIfConfiguredToDoSo(String theServerBase, IHttpClient theHttpClient, IRestfulClient theClient)
This method is internal to HAPI - It may change in future versions, use with caution.
-
-