Package org.glassfish.jersey.client
Class ClientConfig
java.lang.Object
org.glassfish.jersey.client.ClientConfig
- All Implemented Interfaces:
javax.ws.rs.core.Configurable<ClientConfig>,javax.ws.rs.core.Configuration,ExtendedConfig
public class ClientConfig
extends Object
implements javax.ws.rs.core.Configurable<ClientConfig>, ExtendedConfig
Jersey externalized implementation of client-side JAX-RS
configurable contract.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static classDefault encapsulation of the internal configuration state. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstruct a new Jersey configuration instance with the default features and property values.ClientConfig(Class<?>... providerClasses) Construct a new Jersey configuration instance and register the provided list of provider classes.ClientConfig(Object... providers) Construct a new Jersey configuration instance and register the provided list of provider instances.privateClientConfig(ClientConfig.State state) Construct a new Jersey configuration instance using the supplied state.(package private)ClientConfig(JerseyClient parent) Construct a new Jersey configuration instance with the features as well as property values copied from the supplied JAX-RS configuration instance.(package private)ClientConfig(JerseyClient parent, javax.ws.rs.core.Configuration that) Construct a new Jersey configuration instance with the features as well as property values copied from the supplied JAX-RS configuration instance. -
Method Summary
Modifier and TypeMethodDescription(package private) voidCheck that the configuration instance has a parent client set.connectorProvider(ConnectorProvider connectorProvider) Register a custom Jersey client connector provider.booleanexecutorService(ExecutorService executorService) Register custom Jersey client async executor.Get the parent Jersey client this configuration is bound to.Get the client transport connector.Get the client transport connector provider.getContracts(Class<?> componentClass) Get custom client executor service.getProperty(String name) (package private) ClientRuntimeGet the configured runtime.javax.ws.rs.RuntimeTypeGet custom client scheduled executor service.inthashCode()booleanbooleanisEnabled(javax.ws.rs.core.Feature feature) booleanisProperty(String name) Get the value of the property with a given name converted toboolean.booleanisRegistered(Class<?> componentClass) booleanisRegistered(Object component) loadFrom(javax.ws.rs.core.Configuration config) Load the internal configuration state from an externally provided configuration state.(package private) ClientConfigPre initializes this configuration by initializingclient runtimeincludingmessage body workers.scheduledExecutorService(ScheduledExecutorService scheduledExecutorService) Register custom Jersey client scheduler.(package private) ClientConfigsnapshot()Take a snapshot of the current configuration and its internal state.
-
Field Details
-
state
Internal configuration state.
-
-
Constructor Details
-
ClientConfig
public ClientConfig()Construct a new Jersey configuration instance with the default features and property values. -
ClientConfig
Construct a new Jersey configuration instance and register the provided list of provider classes.- Parameters:
providerClasses- provider classes to be registered with this client configuration.
-
ClientConfig
Construct a new Jersey configuration instance and register the provided list of provider instances.- Parameters:
providers- provider instances to be registered with this client configuration.
-
ClientConfig
ClientConfig(JerseyClient parent) Construct a new Jersey configuration instance with the features as well as property values copied from the supplied JAX-RS configuration instance.- Parameters:
parent- parent Jersey client instance.
-
ClientConfig
ClientConfig(JerseyClient parent, javax.ws.rs.core.Configuration that) Construct a new Jersey configuration instance with the features as well as property values copied from the supplied JAX-RS configuration instance.- Parameters:
parent- parent Jersey client instance.that- originalConfiguration.
-
ClientConfig
Construct a new Jersey configuration instance using the supplied state.- Parameters:
state- to be referenced from the new configuration instance.
-
-
Method Details
-
snapshot
ClientConfig snapshot()Take a snapshot of the current configuration and its internal state. The returned configuration object is an new instance different from the original one, however the cloning of the internal configuration state is lazily deferred until either original or the snapshot configuration is modified for the first time since the snapshot was taken.- Returns:
- snapshot of the current configuration.
-
loadFrom
Load the internal configuration state from an externally provided configuration state.Calling this method effectively replaces existing configuration state of the instance with the state represented by the externally provided configuration.
- Parameters:
config- external configuration state to replace the configuration of this configurable instance.- Returns:
- the updated client configuration instance.
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<ClientConfig>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<ClientConfig>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<ClientConfig>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<ClientConfig>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<ClientConfig>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<ClientConfig>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<ClientConfig>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<ClientConfig>
-
property
- Specified by:
propertyin interfacejavax.ws.rs.core.Configurable<ClientConfig>
-
getConfiguration
- Specified by:
getConfigurationin interfacejavax.ws.rs.core.Configurable<ClientConfig>
-
getRuntimeType
public javax.ws.rs.RuntimeType getRuntimeType()- Specified by:
getRuntimeTypein interfacejavax.ws.rs.core.Configuration
-
getProperties
- Specified by:
getPropertiesin interfacejavax.ws.rs.core.Configuration
-
getProperty
- Specified by:
getPropertyin interfacejavax.ws.rs.core.Configuration
-
getPropertyNames
- Specified by:
getPropertyNamesin interfacejavax.ws.rs.core.Configuration
-
isProperty
Description copied from interface:ExtendedConfigGet the value of the property with a given name converted toboolean. Returnsfalseif the value is not convertible.- Specified by:
isPropertyin interfaceExtendedConfig- Parameters:
name- property name.- Returns:
booleanproperty value orfalseif the property is not convertible.
-
isEnabled
public boolean isEnabled(javax.ws.rs.core.Feature feature) - Specified by:
isEnabledin interfacejavax.ws.rs.core.Configuration
-
isEnabled
- Specified by:
isEnabledin interfacejavax.ws.rs.core.Configuration
-
isRegistered
- Specified by:
isRegisteredin interfacejavax.ws.rs.core.Configuration
-
getContracts
- Specified by:
getContractsin interfacejavax.ws.rs.core.Configuration
-
isRegistered
- Specified by:
isRegisteredin interfacejavax.ws.rs.core.Configuration
-
getClasses
- Specified by:
getClassesin interfacejavax.ws.rs.core.Configuration
-
getInstances
- Specified by:
getInstancesin interfacejavax.ws.rs.core.Configuration
-
connectorProvider
Register a custom Jersey client connector provider.The registered
ConnectorProviderinstance will provide a Jersey clientConnectorfor theJerseyClientinstance created with this client configuration.- Parameters:
connectorProvider- custom connector provider. Must not benull.- Returns:
- this client config instance.
- Throws:
NullPointerException- in case theconnectorProviderisnull.- Since:
- 2.5
-
executorService
Register custom Jersey client async executor.- Parameters:
executorService- custom executor service instance- Returns:
- this client config instance
-
scheduledExecutorService
Register custom Jersey client scheduler.- Parameters:
scheduledExecutorService- custom scheduled executor service instance- Returns:
- this client config instance
-
getConnector
Get the client transport connector.May return
nullif no connector has been set.- Returns:
- client transport connector or {code null} if not set.
-
getConnectorProvider
Get the client transport connector provider.If no custom connector provider has been set,
default connector providerinstance is returned.- Returns:
- configured client transport connector provider.
- Since:
- 2.5
-
getExecutorService
Get custom client executor service.May return null if no custom executor service has been set.
- Returns:
- custom executor service instance or
nullif not set. - Since:
- 2.26
-
getScheduledExecutorService
Get custom client scheduled executor service.May return null if no custom scheduled executor service has been set.
- Returns:
- custom executor service instance or
nullif not set. - Since:
- 2.26
-
getRuntime
ClientRuntime getRuntime()Get the configured runtime.- Returns:
- configured runtime.
-
getClientExecutor
-
getClient
Get the parent Jersey client this configuration is bound to.May return
nullif no parent client has been bound.- Returns:
- bound parent Jersey client or
nullif not bound.
-
preInitialize
ClientConfig preInitialize()Pre initializes this configuration by initializingclient runtimeincludingmessage body workers. Once this method is called no other method implementingConfigurableshould be called on this pre initialized configuration otherwise configuration will change back to uninitialized. Note that this method must be called only when configuration is attached to the client.- Returns:
- Client configuration.
-
checkClient
Check that the configuration instance has a parent client set.- Throws:
IllegalStateException- in case no parent Jersey client has been bound to the configuration instance yet.
-
equals
-
hashCode
public int hashCode()
-