Class ResteasyClientBuilderImpl

java.lang.Object
jakarta.ws.rs.client.ClientBuilder
org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
org.jboss.resteasy.client.jaxrs.internal.ResteasyClientBuilderImpl
All Implemented Interfaces:
jakarta.ws.rs.core.Configurable<jakarta.ws.rs.client.ClientBuilder>

public class ResteasyClientBuilderImpl extends org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
Abstraction for creating Clients. Allows SSL configuration. Uses Apache Http Client under the covers. If used with other ClientHttpEngines though, all configuration options are ignored.
Version:
$Revision: 1 $
Author:
Bill Burke
  • Field Details

    • truststore

      protected KeyStore truststore
    • clientKeyStore

      protected KeyStore clientKeyStore
    • clientPrivateKeyPassword

      protected String clientPrivateKeyPassword
    • disableTrustManager

      protected boolean disableTrustManager
    • policy

      protected org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.HostnameVerificationPolicy policy
    • providerFactory

      protected org.jboss.resteasy.spi.ResteasyProviderFactory providerFactory
    • asyncExecutor

      protected ExecutorService asyncExecutor
    • scheduledExecutorService

      protected ScheduledExecutorService scheduledExecutorService
    • cleanupExecutor

      protected boolean cleanupExecutor
    • sslContext

      protected SSLContext sslContext
    • properties

      protected Map<String,Object> properties
    • httpEngine

      protected org.jboss.resteasy.client.jaxrs.ClientHttpEngine httpEngine
    • connectionPoolSize

      protected int connectionPoolSize
    • maxPooledPerRoute

      protected int maxPooledPerRoute
    • connectionTTL

      protected long connectionTTL
    • connectionTTLUnit

      protected TimeUnit connectionTTLUnit
    • socketTimeout

      protected long socketTimeout
    • socketTimeoutUnits

      protected TimeUnit socketTimeoutUnits
    • establishConnectionTimeout

      protected long establishConnectionTimeout
    • establishConnectionTimeoutUnits

      protected TimeUnit establishConnectionTimeoutUnits
    • connectionCheckoutTimeoutMs

      protected int connectionCheckoutTimeoutMs
    • verifier

      protected HostnameVerifier verifier
    • responseBufferSize

      protected int responseBufferSize
    • sniHostNames

      protected List<String> sniHostNames
    • trustSelfSignedCertificates

      protected boolean trustSelfSignedCertificates
    • cookieManagementEnabled

      protected boolean cookieManagementEnabled
    • disableAutomaticRetries

      protected boolean disableAutomaticRetries
    • followRedirects

      protected boolean followRedirects
  • Constructor Details

    • ResteasyClientBuilderImpl

      public ResteasyClientBuilderImpl()
  • Method Details

    • setProviderFactory

      public static void setProviderFactory(org.jboss.resteasy.spi.ResteasyProviderFactory providerFactory)
    • providerFactory

      public ResteasyClientBuilderImpl providerFactory(org.jboss.resteasy.spi.ResteasyProviderFactory providerFactory)
      Changing the providerFactory will wipe clean any registered components or properties.
      Specified by:
      providerFactory in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Parameters:
      providerFactory - provider factory
      Returns:
      the updated client builder instance
    • asyncExecutor

      @Deprecated public ResteasyClientBuilderImpl asyncExecutor(ExecutorService asyncExecutor)
      Deprecated.
      Executor to use to run AsyncInvoker invocations.
      Parameters:
      asyncExecutor - executor service
      Returns:
      the updated client builder instance
    • asyncExecutor

      @Deprecated public ResteasyClientBuilderImpl asyncExecutor(ExecutorService asyncExecutor, boolean cleanupExecutor)
      Deprecated.
      Executor to use to run AsyncInvoker invocations.
      Parameters:
      asyncExecutor - executor service
      cleanupExecutor - true if the Client should close the executor when it is closed
      Returns:
      the updated client builder instance
    • connectionTTL

      public ResteasyClientBuilderImpl connectionTTL(long ttl, TimeUnit unit)
      If there is a connection pool, set the time to live in the pool.
      Specified by:
      connectionTTL in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Parameters:
      ttl - time to live
      unit - the time unit of the ttl argument
      Returns:
      the updated client builder instance
    • readTimeout

      public ResteasyClientBuilderImpl readTimeout(long timeout, TimeUnit unit)
      Specified by:
      readTimeout in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • connectTimeout

      public ResteasyClientBuilderImpl connectTimeout(long timeout, TimeUnit unit)
      Specified by:
      connectTimeout in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • maxPooledPerRoute

      public ResteasyClientBuilderImpl maxPooledPerRoute(int maxPooledPerRoute)
      If connection pooling enabled, how many connections to pool per url?
      Specified by:
      maxPooledPerRoute in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Parameters:
      maxPooledPerRoute - max pool size per url
      Returns:
      the updated client builder instance
    • connectionCheckoutTimeout

      public ResteasyClientBuilderImpl connectionCheckoutTimeout(long timeout, TimeUnit unit)
      If connection pooling is enabled, how long will we wait to get a connection?
      Specified by:
      connectionCheckoutTimeout in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Parameters:
      timeout - the timeout
      unit - the units the timeout is in
      Returns:
      the updated client builder instance
    • connectionPoolSize

      public ResteasyClientBuilderImpl connectionPoolSize(int connectionPoolSize)
      Number of connections allowed to pool.
      Specified by:
      connectionPoolSize in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Parameters:
      connectionPoolSize - connection pool size
      Returns:
      the updated client builder instance
    • responseBufferSize

      public ResteasyClientBuilderImpl responseBufferSize(int size)
      Response stream is wrapped in a BufferedInputStream. Default is 8192. Value of 0 will not wrap it. Value of -1 will use a SelfExpandingBufferedInputStream.
      Specified by:
      responseBufferSize in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Parameters:
      size - response buffer size
      Returns:
      the updated client builder instance
    • disableTrustManager

      public ResteasyClientBuilderImpl disableTrustManager()
      Disable trust management and hostname verification. NOTE this is a security hole, so only set this option if you cannot or do not want to verify the identity of the host you are communicating with.
      Specified by:
      disableTrustManager in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Returns:
      the updated client builder instance
    • hostnameVerification

      public ResteasyClientBuilderImpl hostnameVerification(org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.HostnameVerificationPolicy policy)
      SSL policy used to verify hostnames
      Specified by:
      hostnameVerification in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Parameters:
      policy - SSL policy
      Returns:
      the updated client builder instance
    • httpEngine

      public ResteasyClientBuilderImpl httpEngine(org.jboss.resteasy.client.jaxrs.ClientHttpEngine httpEngine)
      Negates all ssl and connection specific configuration
      Specified by:
      httpEngine in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Parameters:
      httpEngine - http engine
      Returns:
      the updated client builder instance
    • useAsyncHttpEngine

      public ResteasyClientBuilderImpl useAsyncHttpEngine()
      Specified by:
      useAsyncHttpEngine in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • sslContext

      public ResteasyClientBuilderImpl sslContext(SSLContext sslContext)
      Specified by:
      sslContext in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • trustStore

      public ResteasyClientBuilderImpl trustStore(KeyStore truststore)
      Specified by:
      trustStore in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • keyStore

      public ResteasyClientBuilderImpl keyStore(KeyStore keyStore, String password)
      Specified by:
      keyStore in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • keyStore

      public ResteasyClientBuilderImpl keyStore(KeyStore keyStore, char[] password)
      Specified by:
      keyStore in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • property

      public ResteasyClientBuilderImpl property(String name, Object value)
    • sniHostNames

      public ResteasyClientBuilderImpl sniHostNames(String... sniHostNames)
      Adds a TLS/SSL SNI Host Name for authentication.
      Specified by:
      sniHostNames in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Parameters:
      sniHostNames - host names
      Returns:
      the updated client builder instance
    • defaultProxy

      public ResteasyClientBuilderImpl defaultProxy(String hostname)
      Specify a default proxy. Default port and schema will be used.
      Specified by:
      defaultProxy in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Parameters:
      hostname - host name
      Returns:
      the updated client builder instance
    • defaultProxy

      public ResteasyClientBuilderImpl defaultProxy(String hostname, int port)
      Specify a default proxy host and port. Default schema will be used.
      Specified by:
      defaultProxy in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Parameters:
      hostname - host name
      port - port
      Returns:
      the updated client builder instance
    • defaultProxy

      public ResteasyClientBuilderImpl defaultProxy(String hostname, int port, String scheme)
      Specify default proxy.
      Specified by:
      defaultProxy in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
      Parameters:
      hostname - host name
      port - port
      scheme - scheme
      Returns:
      the updated client builder instance
    • getProviderFactory

      public org.jboss.resteasy.spi.ResteasyProviderFactory getProviderFactory()
      Specified by:
      getProviderFactory in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • build

      public org.jboss.resteasy.client.jaxrs.ResteasyClient build()
      Specified by:
      build in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • createResteasyClient

      protected org.jboss.resteasy.client.jaxrs.ResteasyClient createResteasyClient(org.jboss.resteasy.client.jaxrs.ClientHttpEngine engine, ExecutorService executor, boolean cleanupExecutor, ScheduledExecutorService scheduledExecutorService, ClientConfiguration config)
    • hostnameVerifier

      public ResteasyClientBuilderImpl hostnameVerifier(HostnameVerifier verifier)
      Specified by:
      hostnameVerifier in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getConfiguration

      public jakarta.ws.rs.core.Configuration getConfiguration()
    • register

      public ResteasyClientBuilderImpl register(Class<?> componentClass)
    • register

      public ResteasyClientBuilderImpl register(Class<?> componentClass, int priority)
    • register

      public ResteasyClientBuilderImpl register(Class<?> componentClass, Class<?>... contracts)
    • register

      public ResteasyClientBuilderImpl register(Class<?> componentClass, Map<Class<?>,Integer> contracts)
    • register

      public ResteasyClientBuilderImpl register(Object component)
    • register

      public ResteasyClientBuilderImpl register(Object component, int priority)
    • register

      public ResteasyClientBuilderImpl register(Object component, Class<?>... contracts)
    • register

      public ResteasyClientBuilderImpl register(Object component, Map<Class<?>,Integer> contracts)
    • withConfig

      public ResteasyClientBuilderImpl withConfig(jakarta.ws.rs.core.Configuration config)
      Specified by:
      withConfig in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • executorService

      public org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder executorService(ExecutorService executorService)
      Specified by:
      executorService in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • executorService

      public org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder executorService(ExecutorService executorService, boolean cleanupExecutor)
      Specified by:
      executorService in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • scheduledExecutorService

      public org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder scheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
      Specified by:
      scheduledExecutorService in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getConnectionTTL

      public long getConnectionTTL(TimeUnit unit)
      Specified by:
      getConnectionTTL in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getMaxPooledPerRoute

      public int getMaxPooledPerRoute()
      Specified by:
      getMaxPooledPerRoute in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getConnectionCheckoutTimeout

      public long getConnectionCheckoutTimeout(TimeUnit unit)
      Specified by:
      getConnectionCheckoutTimeout in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getConnectionPoolSize

      public int getConnectionPoolSize()
      Specified by:
      getConnectionPoolSize in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getResponseBufferSize

      public int getResponseBufferSize()
      Specified by:
      getResponseBufferSize in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • isTrustManagerDisabled

      public boolean isTrustManagerDisabled()
      Specified by:
      isTrustManagerDisabled in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • isTrustSelfSignedCertificates

      public boolean isTrustSelfSignedCertificates()
      Specified by:
      isTrustSelfSignedCertificates in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • setIsTrustSelfSignedCertificates

      public void setIsTrustSelfSignedCertificates(boolean b)
      Specified by:
      setIsTrustSelfSignedCertificates in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getHostnameVerification

      public org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.HostnameVerificationPolicy getHostnameVerification()
      Specified by:
      getHostnameVerification in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getHttpEngine

      public org.jboss.resteasy.client.jaxrs.ClientHttpEngine getHttpEngine()
      Specified by:
      getHttpEngine in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • isUseAsyncHttpEngine

      public boolean isUseAsyncHttpEngine()
      Specified by:
      isUseAsyncHttpEngine in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getSniHostNames

      public List<String> getSniHostNames()
      Specified by:
      getSniHostNames in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getDefaultProxyHostname

      public String getDefaultProxyHostname()
      Specified by:
      getDefaultProxyHostname in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getDefaultProxyPort

      public int getDefaultProxyPort()
      Specified by:
      getDefaultProxyPort in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getDefaultProxyScheme

      public String getDefaultProxyScheme()
      Specified by:
      getDefaultProxyScheme in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getReadTimeout

      public long getReadTimeout(TimeUnit unit)
      Specified by:
      getReadTimeout in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getConnectionTimeout

      public long getConnectionTimeout(TimeUnit unit)
      Specified by:
      getConnectionTimeout in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getSSLContext

      public SSLContext getSSLContext()
      Specified by:
      getSSLContext in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getKeyStore

      public KeyStore getKeyStore()
      Specified by:
      getKeyStore in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getKeyStorePassword

      public String getKeyStorePassword()
      Specified by:
      getKeyStorePassword in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getTrustStore

      public KeyStore getTrustStore()
      Specified by:
      getTrustStore in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • getHostnameVerifier

      public HostnameVerifier getHostnameVerifier()
      Specified by:
      getHostnameVerifier in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • enableCookieManagement

      public org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder enableCookieManagement()
      Specified by:
      enableCookieManagement in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • isCookieManagementEnabled

      public boolean isCookieManagementEnabled()
      Specified by:
      isCookieManagementEnabled in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • disableAutomaticRetries

      public org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder disableAutomaticRetries()
      Specified by:
      disableAutomaticRetries in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • isDisableAutomaticRetries

      public boolean isDisableAutomaticRetries()
      Specified by:
      isDisableAutomaticRetries in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • setFollowRedirects

      public org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder setFollowRedirects(boolean followRedirects)
      Specified by:
      setFollowRedirects in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
    • isFollowRedirects

      public boolean isFollowRedirects()
      Specified by:
      isFollowRedirects in class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder