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.
Author:
Marek Potociar (marek.potociar at oracle.com), Martin Matula, Libor Kramolis (libor.kramolis at oracle.com)
  • Constructor Details

    • ClientConfig

      public ClientConfig()
      Construct a new Jersey configuration instance with the default features and property values.
    • ClientConfig

      public ClientConfig(Class<?>... providerClasses)
      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

      public ClientConfig(Object... providers)
      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.
  • Method Details

    • loadFrom

      public ClientConfig loadFrom(javax.ws.rs.core.Configuration config)
      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

      public ClientConfig register(Class<?> providerClass)
      Specified by:
      register in interface javax.ws.rs.core.Configurable<ClientConfig>
    • register

      public ClientConfig register(Object provider)
      Specified by:
      register in interface javax.ws.rs.core.Configurable<ClientConfig>
    • register

      public ClientConfig register(Class<?> providerClass, int bindingPriority)
      Specified by:
      register in interface javax.ws.rs.core.Configurable<ClientConfig>
    • register

      public ClientConfig register(Class<?> providerClass, Class<?>... contracts)
      Specified by:
      register in interface javax.ws.rs.core.Configurable<ClientConfig>
    • register

      public ClientConfig register(Class<?> providerClass, Map<Class<?>,Integer> contracts)
      Specified by:
      register in interface javax.ws.rs.core.Configurable<ClientConfig>
    • register

      public ClientConfig register(Object provider, int bindingPriority)
      Specified by:
      register in interface javax.ws.rs.core.Configurable<ClientConfig>
    • register

      public ClientConfig register(Object provider, Class<?>... contracts)
      Specified by:
      register in interface javax.ws.rs.core.Configurable<ClientConfig>
    • register

      public ClientConfig register(Object provider, Map<Class<?>,Integer> contracts)
      Specified by:
      register in interface javax.ws.rs.core.Configurable<ClientConfig>
    • property

      public ClientConfig property(String name, Object value)
      Specified by:
      property in interface javax.ws.rs.core.Configurable<ClientConfig>
    • getConfiguration

      public ClientConfig getConfiguration()
      Specified by:
      getConfiguration in interface javax.ws.rs.core.Configurable<ClientConfig>
    • getRuntimeType

      public javax.ws.rs.RuntimeType getRuntimeType()
      Specified by:
      getRuntimeType in interface javax.ws.rs.core.Configuration
    • getProperties

      public Map<String,Object> getProperties()
      Specified by:
      getProperties in interface javax.ws.rs.core.Configuration
    • getProperty

      public Object getProperty(String name)
      Specified by:
      getProperty in interface javax.ws.rs.core.Configuration
    • getPropertyNames

      public Collection<String> getPropertyNames()
      Specified by:
      getPropertyNames in interface javax.ws.rs.core.Configuration
    • isProperty

      public boolean isProperty(String name)
      Description copied from interface: ExtendedConfig
      Get the value of the property with a given name converted to boolean. Returns false if the value is not convertible.
      Specified by:
      isProperty in interface ExtendedConfig
      Parameters:
      name - property name.
      Returns:
      boolean property value or false if the property is not convertible.
    • isEnabled

      public boolean isEnabled(javax.ws.rs.core.Feature feature)
      Specified by:
      isEnabled in interface javax.ws.rs.core.Configuration
    • isEnabled

      public boolean isEnabled(Class<? extends javax.ws.rs.core.Feature> featureClass)
      Specified by:
      isEnabled in interface javax.ws.rs.core.Configuration
    • isRegistered

      public boolean isRegistered(Object component)
      Specified by:
      isRegistered in interface javax.ws.rs.core.Configuration
    • getContracts

      public Map<Class<?>,Integer> getContracts(Class<?> componentClass)
      Specified by:
      getContracts in interface javax.ws.rs.core.Configuration
    • isRegistered

      public boolean isRegistered(Class<?> componentClass)
      Specified by:
      isRegistered in interface javax.ws.rs.core.Configuration
    • getClasses

      public Set<Class<?>> getClasses()
      Specified by:
      getClasses in interface javax.ws.rs.core.Configuration
    • getInstances

      public Set<Object> getInstances()
      Specified by:
      getInstances in interface javax.ws.rs.core.Configuration
    • connectorProvider

      public ClientConfig connectorProvider(ConnectorProvider connectorProvider)
      Register a custom Jersey client connector provider.

      The registered ConnectorProvider instance will provide a Jersey client Connector for the JerseyClient instance created with this client configuration.

      Parameters:
      connectorProvider - custom connector provider. Must not be null.
      Returns:
      this client config instance.
      Throws:
      NullPointerException - in case the connectorProvider is null.
      Since:
      2.5
    • executorService

      public ClientConfig executorService(ExecutorService executorService)
      Register custom Jersey client async executor.
      Parameters:
      executorService - custom executor service instance
      Returns:
      this client config instance
    • scheduledExecutorService

      public ClientConfig scheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
      Register custom Jersey client scheduler.
      Parameters:
      scheduledExecutorService - custom scheduled executor service instance
      Returns:
      this client config instance
    • getConnector

      public Connector getConnector()
      Get the client transport connector.

      May return null if no connector has been set.

      Returns:
      client transport connector or {code null} if not set.
    • getConnectorProvider

      public ConnectorProvider getConnectorProvider()
      Get the client transport connector provider.

      If no custom connector provider has been set, default connector provider instance is returned.

      Returns:
      configured client transport connector provider.
      Since:
      2.5
    • getExecutorService

      public ExecutorService getExecutorService()
      Get custom client executor service.

      May return null if no custom executor service has been set.

      Returns:
      custom executor service instance or null if not set.
      Since:
      2.26
    • getScheduledExecutorService

      public ScheduledExecutorService 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 null if not set.
      Since:
      2.26
    • getClientExecutor

      public ClientExecutor getClientExecutor()
    • getClient

      public JerseyClient getClient()
      Get the parent Jersey client this configuration is bound to.

      May return null if no parent client has been bound.

      Returns:
      bound parent Jersey client or null if not bound.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object