com.sun.jersey.api.client.config
Interface ClientConfig

All Superinterfaces:
FeaturesAndProperties
All Known Implementing Classes:
DefaultClientConfig

public interface ClientConfig
extends FeaturesAndProperties

The client configuration that declares common property names, features, properties, provider classes and singleton instances that may be used by a Client instance.

An instance of this interface may be passed to the Client when the client is created as follows:

     ClientConfig cc = ...
     Client c = Client.create(cc);
 
The client configuration may be used to register provider classes such as those, for example, that support JAXB with JSON as follows:
     ClientConfig cc = new DefaultClientConfig();
     cc.getClasses().add(com.sun.jersey.impl.provider.entity.JSONRootElementProvider.class);
     Client c = Client.create(cc);
 
Alternatively an implementation of ClientConfig could perform such registration.

Author:
Paul.Sandoz@Sun.Com

Field Summary
static java.lang.String PROPERTY_BUFFER_RESPONSE_ENTITY_ON_EXCEPTION
          A value of "true" declares that the client will automatically buffer the response entity (if any) and close resources when a UniformInterfaceException is thrown.
static java.lang.String PROPERTY_CHUNKED_ENCODING_SIZE
          Chunked encoding property.
static java.lang.String PROPERTY_CONNECT_TIMEOUT
          Connect timeout interval property, in milliseconds.
static java.lang.String PROPERTY_FOLLOW_REDIRECTS
          Redirection property.
static java.lang.String PROPERTY_READ_TIMEOUT
          Read timeout interval property, in milliseconds.
static java.lang.String PROPERTY_THREADPOOL_SIZE
          Threadpool size property.
 
Fields inherited from interface com.sun.jersey.core.util.FeaturesAndProperties
FEATURE_DISABLE_XML_SECURITY, FEATURE_FORMATTED, FEATURE_PRE_1_4_PROVIDER_PRECEDENCE, FEATURE_XMLROOTELEMENT_PROCESSING
 
Method Summary
 java.util.Set<java.lang.Class<?>> getClasses()
          Get the set of provider classes to be instantiated in the scope of the Client
 boolean getPropertyAsFeature(java.lang.String featureName)
          Get a feature that is boolean property of the property bag.
 java.util.Set<java.lang.Object> getSingletons()
          Get the singleton provider instances to be utilized by the client.
 
Methods inherited from interface com.sun.jersey.core.util.FeaturesAndProperties
getFeature, getFeatures, getProperties, getProperty
 

Field Detail

PROPERTY_FOLLOW_REDIRECTS

static final java.lang.String PROPERTY_FOLLOW_REDIRECTS
Redirection property. A value of "true" declares that the client will automatically redirect to the URI declared in 3xx responses. The value MUST be an instance of Boolean. If the property is absent then the default value is "true".

See Also:
Constant Field Values

PROPERTY_READ_TIMEOUT

static final java.lang.String PROPERTY_READ_TIMEOUT
Read timeout interval property, in milliseconds. The value MUST be an instance of Integer. If the property is absent then the default value is an interval of infinity. A value of zero 0 is equivalent to an interval of infinity

See Also:
Constant Field Values

PROPERTY_CONNECT_TIMEOUT

static final java.lang.String PROPERTY_CONNECT_TIMEOUT
Connect timeout interval property, in milliseconds. The value MUST be an instance of Integer. If the property is absent then the default value is an interval of infinity. A value of 0 is equivalent to an interval of infinity

See Also:
Constant Field Values

PROPERTY_CHUNKED_ENCODING_SIZE

static final java.lang.String PROPERTY_CHUNKED_ENCODING_SIZE
Chunked encoding property.

The value MUST be an instance of Integer.

If the property is absent then chunked encoding will not be used. A value < = 0 declares that chunked encoding will be used with the default chunk size. A value > 0 declares that chunked encoding will be used with the value as the declared chunk size.

Note, that this is the default behaviour for the client which does not have to be implemented by all client implementations. A client can define different default behaviour if it is not capable of supporting buffering for example.

See Also:
Constant Field Values

PROPERTY_BUFFER_RESPONSE_ENTITY_ON_EXCEPTION

static final java.lang.String PROPERTY_BUFFER_RESPONSE_ENTITY_ON_EXCEPTION
A value of "true" declares that the client will automatically buffer the response entity (if any) and close resources when a UniformInterfaceException is thrown. The value MUST be an instance of Boolean. If the property is absent then the default value is "true".

See Also:
Constant Field Values

PROPERTY_THREADPOOL_SIZE

static final java.lang.String PROPERTY_THREADPOOL_SIZE
Threadpool size property. The value MUST be an instance of Integer. If the property is absent then threadpool used for async requests will be initialized as default cached threadpool, which creates new thread for every new request, see Executors. When value bigger than zero is provided, cached threadpool limited to that number of threads will be utilized.

See Also:
Constant Field Values
Method Detail

getClasses

java.util.Set<java.lang.Class<?>> getClasses()
Get the set of provider classes to be instantiated in the scope of the Client

A provider class is a Java class with a Provider annotation declared on the class that implements a specific service interface.

Returns:
the mutable set of provider classes. After initialization of the client modification of this value will have no effect. The returned value shall never be null.

getSingletons

java.util.Set<java.lang.Object> getSingletons()
Get the singleton provider instances to be utilized by the client.

When the client is initialized the set of provider instances will be combined and take precedence over the instances of provider classes.

Returns:
the mutable set of provider instances. After initialization of the client modification of this value will have no effect. The returned value shall never be null.

getPropertyAsFeature

boolean getPropertyAsFeature(java.lang.String featureName)
Get a feature that is boolean property of the property bag.

Parameters:
featureName - the name of the feature;
Returns:
true if the feature value is present and is an instance of Boolean and that value is true, otherwise false.


Copyright © 2013 Oracle Corporation. All Rights Reserved.