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

All Known Implementing Classes:
DefaultClientConfig

public interface ClientConfig

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 implementaton of ClientConfig could perform such registeration.

Author:
Paul.Sandoz@Sun.Com

Field Summary
static java.lang.String PROPERTY_CHUNKED_ENCODING_SIZE
          Chunked encoding property.
static java.lang.String PROPERTY_CONNECT_TIMEOUT
          Connect timeout interval property.
static java.lang.String PROPERTY_FOLLOW_REDIRECTS
          Redirection property.
static java.lang.String PROPERTY_READ_TIMEOUT
          Read timeout interval property.
 
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 getFeature(java.lang.String featureName)
          Get the value of a feature.
 java.util.Map<java.lang.String,java.lang.Boolean> getFeatures()
          Get the map of features associated with the client.
 java.util.Map<java.lang.String,java.lang.Object> getProperties()
          Get the map of properties associated with the client.
 java.lang.Object getProperty(java.lang.String propertyName)
          Get the value of a property.
 java.util.Set<java.lang.Object> getSingletons()
          Get the singleton provider instances to be utilized by the client.
 

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. 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. 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.

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 intialization 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 precendence over the instances of provider classes.

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

getFeatures

java.util.Map<java.lang.String,java.lang.Boolean> getFeatures()
Get the map of features associated with the client.

Returns:
the features. The returned value shall never be null.

getFeature

boolean getFeature(java.lang.String featureName)
Get the value of a feature.

Parameters:
featureName - the feature name.
Returns:
true if the feature is present and set to true, otherwise false if the feature is present and set to false or the feature is not present.

getProperties

java.util.Map<java.lang.String,java.lang.Object> getProperties()
Get the map of properties associated with the client.

Returns:
the properties. The returned value shall never be null.

getProperty

java.lang.Object getProperty(java.lang.String propertyName)
Get the value of a property.

Parameters:
propertyName - the property name.
Returns:
the property, or null if there is no property present for the given property name.


Copyright © 2008 Sun Microsystems, Inc. All Rights Reserved.