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
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
Client properties to enable proxy.static final String
Proxy port property name (integer).static final String
Proxy scheme property name (string).Fields inherited from class jakarta.ws.rs.client.ClientBuilder
JAXRS_DEFAULT_CLIENT_BUILDER_PROPERTY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract ResteasyClient
build()
abstract ResteasyClientBuilder
connectionCheckoutTimeout
(long timeout, TimeUnit unit) If connection pooling is enabled, how long will we wait to get a connection?abstract ResteasyClientBuilder
connectionPoolSize
(int connectionPoolSize) Number of connections allowed to pool.abstract ResteasyClientBuilder
connectionTTL
(long ttl, TimeUnit unit) If there is a connection pool, set the time to live in the pool.abstract ResteasyClientBuilder
connectTimeout
(long timeout, TimeUnit unit) abstract ResteasyClientBuilder
defaultProxy
(String hostname) Specify a default proxy.abstract ResteasyClientBuilder
defaultProxy
(String hostname, int port) Specify a default proxy host and port.abstract ResteasyClientBuilder
defaultProxy
(String hostname, int port, String scheme) Specify default proxy.abstract ResteasyClientBuilder
boolean, notify apache to disable its automatic retries.abstract ResteasyClientBuilder
Disable trust management and hostname verification.abstract ResteasyClientBuilder
Enable state (cookie) management.abstract ResteasyClientBuilder
executorService
(ExecutorService executorService) abstract ResteasyClientBuilder
executorService
(ExecutorService executorService, boolean cleanupExecutor) abstract long
abstract int
abstract long
getConnectionTimeout
(TimeUnit unit) abstract long
getConnectionTTL
(TimeUnit unit) abstract String
abstract int
abstract String
abstract HostnameVerifier
abstract ClientHttpEngine
abstract KeyStore
abstract String
abstract int
abstract ResteasyProviderFactory
abstract long
getReadTimeout
(TimeUnit unit) abstract int
abstract SSLContext
abstract KeyStore
abstract ResteasyClientBuilder
SSL policy used to verify hostnamesabstract ResteasyClientBuilder
hostnameVerifier
(HostnameVerifier verifier) abstract ResteasyClientBuilder
httpEngine
(ClientHttpEngine httpEngine) Negates all ssl and connection specific configurationabstract boolean
abstract boolean
abstract boolean
abstract boolean
abstract boolean
abstract boolean
abstract ResteasyClientBuilder
abstract ResteasyClientBuilder
abstract ResteasyClientBuilder
maxPooledPerRoute
(int maxPooledPerRoute) If connection pooling enabled, how many connections to pool per url?abstract ResteasyClientBuilder
providerFactory
(ResteasyProviderFactory providerFactory) Changing the providerFactory will wipe clean any registered components or properties.abstract ResteasyClientBuilder
readTimeout
(long timeout, TimeUnit unit) abstract ResteasyClientBuilder
responseBufferSize
(int size) Response stream is wrapped in a BufferedInputStream.abstract ResteasyClientBuilder
scheduledExecutorService
(ScheduledExecutorService scheduledExecutorService) abstract ResteasyClientBuilder
setFollowRedirects
(boolean followRedirects) Follow redirects added for MicroProfile-rest-client but can be used by tradition clients as well.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.abstract ResteasyClientBuilder
sniHostNames
(String... sniHostNames) Adds a TLS/SSL SNI Host Name for authentication.abstract ResteasyClientBuilder
sslContext
(SSLContext sslContext) abstract ResteasyClientBuilder
trustStore
(KeyStore trustStore) abstract ResteasyClientBuilder
abstract ResteasyClientBuilder
withConfig
(jakarta.ws.rs.core.Configuration config) Methods inherited from class jakarta.ws.rs.client.ClientBuilder
newBuilder, newClient, newClient
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jakarta.ws.rs.core.Configurable
getConfiguration, property, register, register, register, register, register, register, register, register
-
Field Details
-
PROPERTY_PROXY_HOST
Client properties to enable proxy. Proxy host property name (string).- See Also:
-
PROPERTY_PROXY_PORT
-
PROPERTY_PROXY_SCHEME
-
PROPERTY_FOLLOW_REDIRECTS
- See Also:
-
-
Constructor Details
-
ResteasyClientBuilder
public ResteasyClientBuilder()
-
-
Method Details
-
providerFactory
Changing the providerFactory will wipe clean any registered components or properties.- Parameters:
providerFactory
- provider factory- Returns:
- an updated client builder instance
-
getProviderFactory
-
connectionTTL
If there is a connection pool, set the time to live in the pool.- Parameters:
ttl
- time to liveunit
- the time unit of the ttl argument- Returns:
- an updated client builder instance
-
getConnectionTTL
-
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
If connection pooling is enabled, how long will we wait to get a connection?- Parameters:
timeout
- the timeoutunit
- the units the timeout is in- Returns:
- an updated client builder instance
-
getConnectionCheckoutTimeout
-
connectionPoolSize
Number of connections allowed to pool.- Parameters:
connectionPoolSize
- connection pool size- Returns:
- an updated client builder instance
-
getConnectionPoolSize
public abstract int getConnectionPoolSize() -
responseBufferSize
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
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
-
httpEngine
Negates all ssl and connection specific configuration- Parameters:
httpEngine
- http engine- Returns:
- an updated client builder instance
-
getHttpEngine
-
useAsyncHttpEngine
-
isUseAsyncHttpEngine
public abstract boolean isUseAsyncHttpEngine() -
sniHostNames
Adds a TLS/SSL SNI Host Name for authentication.- Parameters:
sniHostNames
- host names- Returns:
- an updated client builder instance
-
getSniHostNames
-
defaultProxy
Specify a default proxy. Default port and schema will be used.- Parameters:
hostname
- host name- Returns:
- an updated client builder instance
-
getDefaultProxyHostname
-
getDefaultProxyPort
public abstract int getDefaultProxyPort() -
getDefaultProxyScheme
-
defaultProxy
Specify a default proxy host and port. Default schema will be used.- Parameters:
hostname
- host nameport
- port- Returns:
- an updated client builder instance
-
defaultProxy
Specify default proxy.- Parameters:
hostname
- host nameport
- portscheme
- scheme- Returns:
- an updated client builder instance
-
enableCookieManagement
Enable state (cookie) management.- Returns:
- the updated client builder instance
-
isCookieManagementEnabled
public abstract boolean isCookieManagementEnabled() -
getSSLContext
-
getKeyStore
-
getKeyStorePassword
-
getTrustStore
-
getHostnameVerifier
-
getReadTimeout
-
getConnectionTimeout
-
disableAutomaticRetries
boolean, notify apache to disable its automatic retries. -
isDisableAutomaticRetries
public abstract boolean isDisableAutomaticRetries() -
executorService
public abstract ResteasyClientBuilder executorService(ExecutorService executorService, boolean cleanupExecutor) -
build
- Specified by:
build
in classjakarta.ws.rs.client.ClientBuilder
-
withConfig
- Specified by:
withConfig
in classjakarta.ws.rs.client.ClientBuilder
-
sslContext
- Specified by:
sslContext
in classjakarta.ws.rs.client.ClientBuilder
-
keyStore
- Specified by:
keyStore
in classjakarta.ws.rs.client.ClientBuilder
-
keyStore
- Overrides:
keyStore
in classjakarta.ws.rs.client.ClientBuilder
-
trustStore
- Specified by:
trustStore
in classjakarta.ws.rs.client.ClientBuilder
-
hostnameVerifier
- Specified by:
hostnameVerifier
in classjakarta.ws.rs.client.ClientBuilder
-
executorService
- Specified by:
executorService
in classjakarta.ws.rs.client.ClientBuilder
-
scheduledExecutorService
public abstract ResteasyClientBuilder scheduledExecutorService(ScheduledExecutorService scheduledExecutorService) - Specified by:
scheduledExecutorService
in classjakarta.ws.rs.client.ClientBuilder
-
connectTimeout
- Specified by:
connectTimeout
in classjakarta.ws.rs.client.ClientBuilder
-
readTimeout
- Specified by:
readTimeout
in classjakarta.ws.rs.client.ClientBuilder
-
setFollowRedirects
Follow redirects added for MicroProfile-rest-client but can be used by tradition clients as well.- Parameters:
followRedirects
-- Returns:
-
isFollowRedirects
public abstract boolean isFollowRedirects()
-