Class ResteasyClientBuilder

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

public class ResteasyClientBuilder extends javax.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 $
  • Field Details

    • truststore

      protected KeyStore truststore
    • clientKeyStore

      protected KeyStore clientKeyStore
    • clientPrivateKeyPassword

      protected String clientPrivateKeyPassword
    • disableTrustManager

      protected boolean disableTrustManager
    • policy

    • providerFactory

      protected ResteasyProviderFactory providerFactory
    • asyncExecutor

      protected ExecutorService asyncExecutor
    • cleanupExecutor

      protected boolean cleanupExecutor
    • sslContext

      protected SSLContext sslContext
    • properties

      protected Map<String,Object> properties
    • httpEngine

      protected 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
    • defaultProxy

      protected org.apache.http.HttpHost defaultProxy
    • responseBufferSize

      protected int responseBufferSize
    • sniHostNames

      protected List<String> sniHostNames
  • Constructor Details

    • ResteasyClientBuilder

      public ResteasyClientBuilder()
  • Method Details

    • providerFactory

      public ResteasyClientBuilder providerFactory(ResteasyProviderFactory providerFactory)
      Changing the providerFactory will wipe clean any registered components or properties.
      Parameters:
      providerFactory -
      Returns:
    • asyncExecutor

      public ResteasyClientBuilder asyncExecutor(ExecutorService asyncExecutor)
      Executor to use to run AsyncInvoker invocations
      Parameters:
      asyncExecutor -
      Returns:
    • asyncExecutor

      public ResteasyClientBuilder asyncExecutor(ExecutorService asyncExecutor, boolean cleanupExecutor)
      Executor to use to run AsyncInvoker invocations
      Parameters:
      asyncExecutor -
      cleanupExecutor - true if the Client should close the executor when it is closed
      Returns:
    • connectionTTL

      public ResteasyClientBuilder connectionTTL(long ttl, TimeUnit unit)
      If there is a connection pool, set the time to live in the pool.
      Parameters:
      ttl -
      unit -
      Returns:
    • socketTimeout

      public ResteasyClientBuilder socketTimeout(long timeout, TimeUnit unit)
      The timeout for waiting for data. A timeout value of zero is interpreted as an infinite timeout
      Parameters:
      timeout -
      unit -
      Returns:
    • establishConnectionTimeout

      public ResteasyClientBuilder establishConnectionTimeout(long timeout, TimeUnit unit)
      When trying to make an initial socket connection, what is the timeout?
      Parameters:
      timeout -
      unit -
      Returns:
    • maxPooledPerRoute

      public ResteasyClientBuilder maxPooledPerRoute(int maxPooledPerRoute)
      If connection pooling enabled, how many connections to pool per url?
      Parameters:
      maxPooledPerRoute -
      Returns:
    • connectionCheckoutTimeout

      public 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:
      this builder
    • connectionPoolSize

      public ResteasyClientBuilder connectionPoolSize(int connectionPoolSize)
      Number of connections allowed to pool
      Parameters:
      connectionPoolSize -
      Returns:
    • responseBufferSize

      public 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 -
      Returns:
    • disableTrustManager

      public 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.
    • hostnameVerification

      SSL policy used to verify hostnames
      Parameters:
      policy -
      Returns:
    • httpEngine

      public ResteasyClientBuilder httpEngine(ClientHttpEngine httpEngine)
      Negates all ssl and connection specific configuration
      Parameters:
      httpEngine -
      Returns:
    • sslContext

      public ResteasyClientBuilder sslContext(SSLContext sslContext)
      Specified by:
      sslContext in class javax.ws.rs.client.ClientBuilder
    • trustStore

      public ResteasyClientBuilder trustStore(KeyStore truststore)
      Specified by:
      trustStore in class javax.ws.rs.client.ClientBuilder
    • keyStore

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

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

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

      public ResteasyClientBuilder sniHostNames(String... sniHostNames)
      Adds a TLS/SSL SNI Host Name for authentication.
      Parameters:
      sniHostNames -
      Returns:
    • defaultProxy

      public ResteasyClientBuilder defaultProxy(String hostname)
      Specify a default proxy. Default port and schema will be used
      Parameters:
      hostname -
      Returns:
    • defaultProxy

      public ResteasyClientBuilder defaultProxy(String hostname, int port)
      Specify a default proxy host and port. Default schema will be used
      Parameters:
      hostname -
      port -
      Returns:
    • defaultProxy

      public ResteasyClientBuilder defaultProxy(String hostname, int port, String scheme)
      Specify default proxy.
      Parameters:
      hostname -
      port -
      scheme -
      Returns:
    • getProviderFactory

      protected ResteasyProviderFactory getProviderFactory()
    • buildOld

      @Deprecated public ResteasyClient buildOld()
      Deprecated.
    • build

      public ResteasyClient build()
      Specified by:
      build in class javax.ws.rs.client.ClientBuilder
    • prepareSocketForSni

      protected void prepareSocketForSni(SSLSocket socket)
    • hostnameVerifier

      public ResteasyClientBuilder hostnameVerifier(HostnameVerifier verifier)
      Specified by:
      hostnameVerifier in class javax.ws.rs.client.ClientBuilder
    • getConfiguration

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

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

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

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

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

      public ResteasyClientBuilder register(Object component)
    • register

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

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

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

      public ResteasyClientBuilder withConfig(javax.ws.rs.core.Configuration config)
      Specified by:
      withConfig in class javax.ws.rs.client.ClientBuilder