Class ResteasyClientBuilder

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

public abstract class ResteasyClientBuilder extends jakarta.ws.rs.client.ClientBuilder
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

    • PROPERTY_PROXY_HOST

      public static final String PROPERTY_PROXY_HOST
      Client properties to enable proxy. Proxy host property name (string).
      See Also:
    • PROPERTY_PROXY_PORT

      public static final String PROPERTY_PROXY_PORT
      Proxy port property name (integer).
      See Also:
    • PROPERTY_PROXY_SCHEME

      public static final String PROPERTY_PROXY_SCHEME
      Proxy scheme property name (string).
      See Also:
    • PROPERTY_FOLLOW_REDIRECTS

      public static final String PROPERTY_FOLLOW_REDIRECTS
      See Also:
  • Constructor Details

    • ResteasyClientBuilder

      public ResteasyClientBuilder()
  • Method Details

    • providerFactory

      public abstract ResteasyClientBuilder providerFactory(ResteasyProviderFactory providerFactory)
      Changing the providerFactory will wipe clean any registered components or properties.
      Parameters:
      providerFactory - provider factory
      Returns:
      an updated client builder instance
    • getProviderFactory

      public abstract ResteasyProviderFactory getProviderFactory()
    • connectionTTL

      public abstract ResteasyClientBuilder connectionTTL(long ttl, TimeUnit unit)
      If there is a connection pool, set the time to live in the pool.
      Parameters:
      ttl - time to live
      unit - the time unit of the ttl argument
      Returns:
      an updated client builder instance
    • getConnectionTTL

      public abstract long getConnectionTTL(TimeUnit unit)
    • maxPooledPerRoute

      public abstract ResteasyClientBuilder maxPooledPerRoute(int maxPooledPerRoute)
      If connection pooling enabled, how many connections to pool per url?
      Parameters:
      maxPooledPerRoute - max pool size per url
      Returns:
      an updated client builder instance
    • getMaxPooledPerRoute

      public abstract int getMaxPooledPerRoute()
    • connectionCheckoutTimeout

      public abstract ResteasyClientBuilder connectionCheckoutTimeout(long timeout, TimeUnit unit)
      If connection pooling is enabled, how long will we wait to get a connection?
      Parameters:
      timeout - the timeout
      unit - the units the timeout is in
      Returns:
      an updated client builder instance
    • getConnectionCheckoutTimeout

      public abstract long getConnectionCheckoutTimeout(TimeUnit unit)
    • connectionPoolSize

      public abstract ResteasyClientBuilder connectionPoolSize(int connectionPoolSize)
      Number of connections allowed to pool.
      Parameters:
      connectionPoolSize - connection pool size
      Returns:
      an updated client builder instance
    • getConnectionPoolSize

      public abstract int getConnectionPoolSize()
    • responseBufferSize

      public abstract ResteasyClientBuilder 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.
      Parameters:
      size - response buffer size
      Returns:
      an updated client builder instance
    • getResponseBufferSize

      public abstract int getResponseBufferSize()
    • disableTrustManager

      public abstract ResteasyClientBuilder 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.
      Returns:
      an updated client builder instance
    • isTrustManagerDisabled

      public abstract boolean isTrustManagerDisabled()
    • setIsTrustSelfSignedCertificates

      public abstract void setIsTrustSelfSignedCertificates(boolean b)
      When the user is not using a TrustManager (see disableTrustManager) and does not define an SSLContext object but they want all defined trustStores to use the TrustSelfSignedCertificates trust strategy set this value to true.
      Parameters:
      b - A value of true assigns trust strategy TrustSelfSignedCertificates to the trustStores. A value of false assigns a null to the trust strategy. The default value is true in order to maintain backward compatibility.
    • isTrustSelfSignedCertificates

      public abstract boolean isTrustSelfSignedCertificates()
    • hostnameVerification

      public abstract ResteasyClientBuilder hostnameVerification(ResteasyClientBuilder.HostnameVerificationPolicy policy)
      SSL policy used to verify hostnames
      Parameters:
      policy - SSL policy
      Returns:
      an updated client builder instance
    • getHostnameVerification

      public abstract ResteasyClientBuilder.HostnameVerificationPolicy getHostnameVerification()
    • httpEngine

      public abstract ResteasyClientBuilder httpEngine(ClientHttpEngine httpEngine)
      Negates all ssl and connection specific configuration
      Parameters:
      httpEngine - http engine
      Returns:
      an updated client builder instance
    • getHttpEngine

      public abstract ClientHttpEngine getHttpEngine()
    • useAsyncHttpEngine

      public abstract ResteasyClientBuilder useAsyncHttpEngine()
    • isUseAsyncHttpEngine

      public abstract boolean isUseAsyncHttpEngine()
    • sniHostNames

      public abstract ResteasyClientBuilder sniHostNames(String... sniHostNames)
      Adds a TLS/SSL SNI Host Name for authentication.
      Parameters:
      sniHostNames - host names
      Returns:
      an updated client builder instance
    • getSniHostNames

      public abstract List<String> getSniHostNames()
    • defaultProxy

      public abstract ResteasyClientBuilder defaultProxy(String hostname)
      Specify a default proxy. Default port and schema will be used.
      Parameters:
      hostname - host name
      Returns:
      an updated client builder instance
    • getDefaultProxyHostname

      public abstract String getDefaultProxyHostname()
    • getDefaultProxyPort

      public abstract int getDefaultProxyPort()
    • getDefaultProxyScheme

      public abstract String getDefaultProxyScheme()
    • defaultProxy

      public abstract ResteasyClientBuilder defaultProxy(String hostname, int port)
      Specify a default proxy host and port. Default schema will be used.
      Parameters:
      hostname - host name
      port - port
      Returns:
      an updated client builder instance
    • defaultProxy

      public abstract ResteasyClientBuilder defaultProxy(String hostname, int port, String scheme)
      Specify default proxy.
      Parameters:
      hostname - host name
      port - port
      scheme - scheme
      Returns:
      an updated client builder instance
    • enableCookieManagement

      public abstract ResteasyClientBuilder enableCookieManagement()
      Enable state (cookie) management.
      Returns:
      the updated client builder instance
    • isCookieManagementEnabled

      public abstract boolean isCookieManagementEnabled()
    • getSSLContext

      public abstract SSLContext getSSLContext()
    • getKeyStore

      public abstract KeyStore getKeyStore()
    • getKeyStorePassword

      public abstract String getKeyStorePassword()
    • getTrustStore

      public abstract KeyStore getTrustStore()
    • getHostnameVerifier

      public abstract HostnameVerifier getHostnameVerifier()
    • getReadTimeout

      public abstract long getReadTimeout(TimeUnit unit)
    • getConnectionTimeout

      public abstract long getConnectionTimeout(TimeUnit unit)
    • disableAutomaticRetries

      public abstract ResteasyClientBuilder disableAutomaticRetries()
      boolean, notify apache to disable its automatic retries.
    • isDisableAutomaticRetries

      public abstract boolean isDisableAutomaticRetries()
    • executorService

      public abstract ResteasyClientBuilder executorService(ExecutorService executorService, boolean cleanupExecutor)
    • build

      public abstract ResteasyClient build()
      Specified by:
      build in class jakarta.ws.rs.client.ClientBuilder
    • withConfig

      public abstract ResteasyClientBuilder withConfig(jakarta.ws.rs.core.Configuration config)
      Specified by:
      withConfig in class jakarta.ws.rs.client.ClientBuilder
    • sslContext

      public abstract ResteasyClientBuilder sslContext(SSLContext sslContext)
      Specified by:
      sslContext in class jakarta.ws.rs.client.ClientBuilder
    • keyStore

      public abstract ResteasyClientBuilder keyStore(KeyStore keyStore, char[] password)
      Specified by:
      keyStore in class jakarta.ws.rs.client.ClientBuilder
    • keyStore

      public abstract ResteasyClientBuilder keyStore(KeyStore keyStore, String password)
      Overrides:
      keyStore in class jakarta.ws.rs.client.ClientBuilder
    • trustStore

      public abstract ResteasyClientBuilder trustStore(KeyStore trustStore)
      Specified by:
      trustStore in class jakarta.ws.rs.client.ClientBuilder
    • hostnameVerifier

      public abstract ResteasyClientBuilder hostnameVerifier(HostnameVerifier verifier)
      Specified by:
      hostnameVerifier in class jakarta.ws.rs.client.ClientBuilder
    • executorService

      public abstract ResteasyClientBuilder executorService(ExecutorService executorService)
      Specified by:
      executorService in class jakarta.ws.rs.client.ClientBuilder
    • scheduledExecutorService

      public abstract ResteasyClientBuilder scheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
      Specified by:
      scheduledExecutorService in class jakarta.ws.rs.client.ClientBuilder
    • connectTimeout

      public abstract ResteasyClientBuilder connectTimeout(long timeout, TimeUnit unit)
      Specified by:
      connectTimeout in class jakarta.ws.rs.client.ClientBuilder
    • readTimeout

      public abstract ResteasyClientBuilder readTimeout(long timeout, TimeUnit unit)
      Specified by:
      readTimeout in class jakarta.ws.rs.client.ClientBuilder
    • setFollowRedirects

      public abstract ResteasyClientBuilder setFollowRedirects(boolean followRedirects)
      Follow redirects added for MicroProfile-rest-client but can be used by tradition clients as well.
      Parameters:
      followRedirects -
      Returns:
    • isFollowRedirects

      public abstract boolean isFollowRedirects()