Class JaxRsRestfulClientFactory

java.lang.Object
ca.uhn.fhir.rest.client.impl.RestfulClientFactory
ca.uhn.fhir.jaxrs.client.JaxRsRestfulClientFactory
All Implemented Interfaces:
ca.uhn.fhir.rest.client.api.IRestfulClientFactory

public class JaxRsRestfulClientFactory extends ca.uhn.fhir.rest.client.impl.RestfulClientFactory
A Restful Client Factory, based on Jax Rs Default Jax-Rs client is NOT thread safe in static context, you should create a new factory every time or use a specific Jax-Rs client implementation which managed connection pool.
Author:
Peter Van Houte | peter.vanhoute@agfa.com | Agfa Healthcare
  • 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

    Constructors
    Constructor
    Description
    Constructor.
    JaxRsRestfulClientFactory(ca.uhn.fhir.context.FhirContext theFhirContext)
    Constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    protected JaxRsHttpClient
    getHttpClient(String theServerBase)
     
    ca.uhn.fhir.rest.client.api.IHttpClient
    getHttpClient(StringBuilder url, Map<String,List<String>> theIfNoneExistParams, String theIfNoneExistString, ca.uhn.fhir.rest.api.RequestTypeEnum theRequestType, List<ca.uhn.fhir.rest.client.api.Header> theHeaders)
     
    jakarta.ws.rs.client.Client
     
    void
    register(List<Class<?>> components)
    Register a list of Jax-Rs component (provider, filter...)
    protected void
     
    void
    setHttpClient(Object theHttpClient)
    Only accept clients of type jakarta.ws.rs.client.Client Can be used to set a specific Client implementation
    void
    setProxy(String theHost, Integer thePort)
    Not supported with default Jax-Rs client implementation

    Methods inherited from class ca.uhn.fhir.rest.client.impl.RestfulClientFactory

    getConnectionRequestTimeout, getConnectionTimeToLive, getConnectTimeout, getFhirContext, getPoolMaxPerRoute, getPoolMaxTotal, getProxyPassword, getProxyUsername, getServerValidationMode, getServerValidationModeEnum, getSocketTimeout, newClient, newGenericClient, setConnectionRequestTimeout, setConnectionTimeToLive, setConnectTimeout, setFhirContext, setPoolMaxPerRoute, setPoolMaxTotal, setProxyCredentials, setServerValidationMode, setServerValidationModeEnum, setSocketTimeout, validateConfigured, validateServerBase, validateServerBaseIfConfiguredToDoSo

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JaxRsRestfulClientFactory

      Constructor. Note that you must set the FhirContext manually using RestfulClientFactory.setFhirContext(FhirContext) if this constructor is used!
    • JaxRsRestfulClientFactory

      public JaxRsRestfulClientFactory(ca.uhn.fhir.context.FhirContext theFhirContext)
      Constructor
      Parameters:
      theFhirContext - The context
  • Method Details

    • getNativeClientClient

      public jakarta.ws.rs.client.Client getNativeClientClient()
    • getHttpClient

      public ca.uhn.fhir.rest.client.api.IHttpClient getHttpClient(StringBuilder url, Map<String,List<String>> theIfNoneExistParams, String theIfNoneExistString, ca.uhn.fhir.rest.api.RequestTypeEnum theRequestType, List<ca.uhn.fhir.rest.client.api.Header> theHeaders)
    • setProxy

      public void setProxy(String theHost, Integer thePort)
      Not supported with default Jax-Rs client implementation
      Parameters:
      theHost - The host (or null to disable proxying, as is the default)
      thePort -
    • setHttpClient

      public void setHttpClient(Object theHttpClient)
      Only accept clients of type jakarta.ws.rs.client.Client Can be used to set a specific Client implementation
      Parameters:
      theHttpClient -
    • register

      public void register(List<Class<?>> components)
      Register a list of Jax-Rs component (provider, filter...)
      Parameters:
      components - list of Jax-Rs components to register
    • getHttpClient

      protected JaxRsHttpClient getHttpClient(String theServerBase)
      Specified by:
      getHttpClient in class ca.uhn.fhir.rest.client.impl.RestfulClientFactory
    • resetHttpClient

      protected void resetHttpClient()
      Specified by:
      resetHttpClient in class ca.uhn.fhir.rest.client.impl.RestfulClientFactory