Class ClientConfig

  • All Implemented Interfaces:
    jakarta.ws.rs.core.Configurable<ClientConfig>, jakarta.ws.rs.core.Configuration, ExtendedConfig

    public class ClientConfig
    extends Object
    implements jakarta.ws.rs.core.Configurable<ClientConfig>, ExtendedConfig
    Jersey externalized implementation of client-side JAX-RS configurable contract.
    Author:
    Marek Potociar, Martin Matula, Libor Kramolis, Gaurav Gupta (gaurav.gupta@payara.fish)
    • Constructor Detail

      • 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 Detail

      • loadFrom

        public ClientConfig loadFrom​(jakarta.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 jakarta.ws.rs.core.Configurable<ClientConfig>
      • register

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        public Set<Object> getInstances()
        Specified by:
        getInstances in interface jakarta.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
      • 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.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object