Class ResteasyClientBuilder
- All Implemented Interfaces:
Configurable<ClientBuilder>
- Direct Known Subclasses:
ResteasyClientBuilderImpl
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringClient properties to enable proxy.static final StringProxy port property name (integer).static final StringProxy scheme property name (string).Fields inherited from class jakarta.ws.rs.client.ClientBuilder
JAXRS_DEFAULT_CLIENT_BUILDER_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ResteasyClientbuild()Build a new client instance using all the configuration previously specified in this client builder.abstract ResteasyClientBuilderconnectionCheckoutTimeout(long timeout, TimeUnit unit) If connection pooling is enabled, how long will we wait to get a connection?abstract ResteasyClientBuilderconnectionPoolSize(int connectionPoolSize) Number of connections allowed to pool.abstract ResteasyClientBuilderconnectionTTL(long ttl, TimeUnit unit) If there is a connection pool, set the time to live in the pool.abstract ResteasyClientBuilderconnectTimeout(long timeout, TimeUnit unit) Set the connect timeout.abstract ResteasyClientBuilderdefaultProxy(String hostname) Specify a default proxy.abstract ResteasyClientBuilderdefaultProxy(String hostname, int port) Specify a default proxy host and port.abstract ResteasyClientBuilderdefaultProxy(String hostname, int port, String scheme) Specify default proxy.abstract ResteasyClientBuilderboolean, notify apache to disable its automatic retries.abstract ResteasyClientBuilderDisable trust management and hostname verification.abstract ResteasyClientBuilderEnable state (cookie) management.abstract ResteasyClientBuilderexecutorService(ExecutorService executorService) Set the client-sideExecutorService.abstract ResteasyClientBuilderexecutorService(ExecutorService executorService, boolean cleanupExecutor) abstract longabstract intabstract longgetConnectionTimeout(TimeUnit unit) abstract longgetConnectionTTL(TimeUnit unit) abstract Stringabstract intabstract Stringabstract HostnameVerifierabstract ClientHttpEngineabstract KeyStoreabstract Stringabstract intabstract ResteasyProviderFactoryabstract longgetReadTimeout(TimeUnit unit) abstract intabstract SSLContextabstract KeyStoreabstract ResteasyClientBuilderSSL policy used to verify hostnamesabstract ResteasyClientBuilderhostnameVerifier(HostnameVerifier verifier) Set the hostname verifier to be used by the client to verify the endpoint's hostname against it's identification information.abstract ResteasyClientBuilderhttpEngine(ClientHttpEngine httpEngine) Negates all ssl and connection specific configurationabstract booleanabstract booleanabstract booleanabstract booleanabstract booleanabstract booleanabstract ResteasyClientBuilderSet the client-side key store.abstract ResteasyClientBuilderSet the client-side key store.abstract ResteasyClientBuildermaxPooledPerRoute(int maxPooledPerRoute) If connection pooling enabled, how many connections to pool per url?abstract ResteasyClientBuilderproviderFactory(ResteasyProviderFactory providerFactory) Changing the providerFactory will wipe clean any registered components or properties.abstract ResteasyClientBuilderreadTimeout(long timeout, TimeUnit unit) Set the read timeout.abstract ResteasyClientBuilderresponseBufferSize(int size) Response stream is wrapped in a BufferedInputStream.abstract ResteasyClientBuilderscheduledExecutorService(ScheduledExecutorService scheduledExecutorService) Set the client-sideScheduledExecutorService.abstract ResteasyClientBuildersetFollowRedirects(boolean followRedirects) Follow redirects added for MicroProfile-rest-client but can be used by tradition clients as well.abstract voidsetIsTrustSelfSignedCertificates(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 ResteasyClientBuildersniHostNames(String... sniHostNames) Adds a TLS/SSL SNI Host Name for authentication.abstract ResteasyClientBuildersslContext(SSLContext sslContext) Set the SSL context that will be used when creating secured transport connections to server endpoints fromweb targetscreated by the client instance that is using this SSL context.abstract ResteasyClientBuildertrustStore(KeyStore trustStore) Set the client-side trust store.abstract ResteasyClientBuilderabstract ResteasyClientBuilderwithConfig(Configuration config) Set the internal configuration state to an externally provided configuration state.Methods inherited from class jakarta.ws.rs.client.ClientBuilder
newBuilder, newClient, newClient
-
Field Details
-
PROPERTY_PROXY_HOST
Client properties to enable proxy. Proxy host property name (string).- See Also:
-
PROPERTY_PROXY_PORT
Proxy port property name (integer).- See Also:
-
PROPERTY_PROXY_SCHEME
Proxy scheme property name (string).- See Also:
-
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
Description copied from class:ClientBuilderBuild a new client instance using all the configuration previously specified in this client builder.- Specified by:
buildin classClientBuilder- Returns:
- a new client instance.
-
withConfig
Description copied from class:ClientBuilderSet the internal configuration state to an externally provided configuration state.- Specified by:
withConfigin classClientBuilder- Parameters:
config- external configuration state to replace the configuration of this configurable instance.- Returns:
- the updated client builder instance.
-
sslContext
Description copied from class:ClientBuilderSet the SSL context that will be used when creating secured transport connections to server endpoints fromweb targetscreated by the client instance that is using this SSL context. The SSL context is expected to have all the security infrastructure initialized, including the key and trust managers.Setting a SSL context instance resets any
key storeortrust storevalues previously specified.- Specified by:
sslContextin classClientBuilder- Parameters:
sslContext- secure socket protocol implementation which acts as a factory for secure socket factories orSSL engines. Must not benull.- Returns:
- an updated client builder instance.
- See Also:
-
keyStore
Description copied from class:ClientBuilderSet the client-side key store. Key store contains client's private keys, and the certificates with their corresponding public keys.Setting a key store instance resets any
SSL context instancevalue previously specified.Note that a custom key store is only required if you want to enable a custom setup of a 2-way SSL connections (client certificate authentication).
- Specified by:
keyStorein classClientBuilder- Parameters:
keyStore- client-side key store. Must not benull.password- client key password. Must not benull.- Returns:
- an updated client builder instance.
- See Also:
-
keyStore
Description copied from class:ClientBuilderSet the client-side key store. Key store contains client's private keys, and the certificates with their corresponding public keys.Setting a key store instance resets any
SSL context instancevalue previously specified.Note that for improved security of working with password data and avoid storing passwords in Java string objects, the
ClientBuilder.keyStore(java.security.KeyStore, char[])version of the method can be utilized. Also note that a custom key store is only required if you want to enable a custom setup of a 2-way SSL connections (client certificate authentication).- Overrides:
keyStorein classClientBuilder- Parameters:
keyStore- client-side key store. Must not benull.password- client key password. Must not benull.- Returns:
- an updated client builder instance.
- See Also:
-
trustStore
Description copied from class:ClientBuilderSet the client-side trust store. Trust store is expected to contain certificates from other parties the client is you expect to communicate with, or from Certificate Authorities that are trusted to identify other parties.Setting a trust store instance resets any
SSL context instancevalue previously specified.In case a custom trust store or custom SSL context is not specified, the trust management will be configured to use the default Java runtime settings.
- Specified by:
trustStorein classClientBuilder- Parameters:
trustStore- client-side trust store. Must not benull.- Returns:
- an updated client builder instance.
- See Also:
-
hostnameVerifier
Description copied from class:ClientBuilderSet the hostname verifier to be used by the client to verify the endpoint's hostname against it's identification information.- Specified by:
hostnameVerifierin classClientBuilder- Parameters:
verifier- hostname verifier.- Returns:
- an updated client builder instance.
-
executorService
Description copied from class:ClientBuilderSet the client-sideExecutorService.Provided executor service will be used for executing asynchronous tasks.
When running in a Jakarta EE container, implementations are required to use the container-managed executor service by default. In Java SE, the default is implementation-specific. In either case, calling this method will override the default.
- Specified by:
executorServicein classClientBuilder- Parameters:
executorService- executor service to be used for async invocations.- Returns:
- an updated client builder instance.
- See Also:
-
scheduledExecutorService
public abstract ResteasyClientBuilder scheduledExecutorService(ScheduledExecutorService scheduledExecutorService) Description copied from class:ClientBuilderSet the client-sideScheduledExecutorService.Provided executor service will be used for executing scheduled asynchronous tasks.
When running in a Jakarta EE container, implementations are required to use the container-managed scheduled executor service by default. In Java SE the default is implementation-specific. In either case, calling this method will override the default.
- Specified by:
scheduledExecutorServicein classClientBuilder- Parameters:
scheduledExecutorService- executor service to be used for scheduled async invocations.- Returns:
- an updated client builder instance.
- See Also:
-
connectTimeout
Description copied from class:ClientBuilderSet the connect timeout.Value
0represents infinity. Negative values are not allowed.- Specified by:
connectTimeoutin classClientBuilder- Parameters:
timeout- the maximum time to wait.unit- the time unit of the timeout argument.- Returns:
- an updated client builder instance.
-
readTimeout
Description copied from class:ClientBuilderSet the read timeout.The value is the timeout to read a response. If the server doesn't respond within the defined timeframe,
ProcessingExceptionis thrown withTimeoutExceptionas a cause.Value
0represents infinity. Negative values are not allowed.- Specified by:
readTimeoutin classClientBuilder- Parameters:
timeout- the maximum time to wait.unit- the time unit of the timeout argument.- Returns:
- an updated client builder instance.
-
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()
-