Package org.jboss.resteasy.client.jaxrs
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
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()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) 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) 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) abstract ResteasyClientBuilderhttpEngine(ClientHttpEngine httpEngine) Negates all ssl and connection specific configurationabstract booleanabstract booleanabstract booleanabstract booleanabstract booleanabstract booleanabstract ResteasyClientBuilderabstract ResteasyClientBuilderabstract 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) abstract ResteasyClientBuilderresponseBufferSize(int size) Response stream is wrapped in a BufferedInputStream.abstract ResteasyClientBuilderscheduledExecutorService(ScheduledExecutorService scheduledExecutorService) 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) abstract ResteasyClientBuildertrustStore(KeyStore trustStore) abstract ResteasyClientBuilderabstract ResteasyClientBuilderwithConfig(jakarta.ws.rs.core.Configuration config) Methods inherited from class jakarta.ws.rs.client.ClientBuilder
newBuilder, newClient, newClientMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
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
- Specified by:
buildin classjakarta.ws.rs.client.ClientBuilder
-
withConfig
- Specified by:
withConfigin classjakarta.ws.rs.client.ClientBuilder
-
sslContext
- Specified by:
sslContextin classjakarta.ws.rs.client.ClientBuilder
-
keyStore
- Specified by:
keyStorein classjakarta.ws.rs.client.ClientBuilder
-
keyStore
- Overrides:
keyStorein classjakarta.ws.rs.client.ClientBuilder
-
trustStore
- Specified by:
trustStorein classjakarta.ws.rs.client.ClientBuilder
-
hostnameVerifier
- Specified by:
hostnameVerifierin classjakarta.ws.rs.client.ClientBuilder
-
executorService
- Specified by:
executorServicein classjakarta.ws.rs.client.ClientBuilder
-
scheduledExecutorService
public abstract ResteasyClientBuilder scheduledExecutorService(ScheduledExecutorService scheduledExecutorService) - Specified by:
scheduledExecutorServicein classjakarta.ws.rs.client.ClientBuilder
-
connectTimeout
- Specified by:
connectTimeoutin classjakarta.ws.rs.client.ClientBuilder
-
readTimeout
- Specified by:
readTimeoutin 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()
-