|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Configuration
Represents inheritable configuration of the main client-side JAX-RS components,
such as Client, WebTarget, Invocation Builder
or Invocation.
resource targets using a Client instance,
the configuration of the Client instance is inherited by the child target
instances being created. Similarly, when creating new
Invocation.Builder invocation builders or derived resource targets
using a parent target instance, the configuration of the parent target is
inherited by the child instances being created.
The inherited configuration on a child instance reflects the state of the parent
configuration at the time of the child instance creation. Once the child instance
is created its configuration is detached from the parent configuration. This means
that any subsequent changes in the parent configuration do not affect
the configuration of previously created child instances.
Once the child instance is created, it's configuration can be further customized
using the provided set of instance configuration mutator methods. A change
made in the configuration of a child instance does not affect the configuration
of its parent, for example:
Client client = ClientFactory.newClient();
client.configuration().setProperty("FOO_PROPERTY", "FOO_VALUE");
// inherits the configured "FOO_PROPERTY" from the client instance
WebTarget resourceTarget = client.target("http://examples.jaxrs.com/");
// does not modify the client instance configuration
resourceTarget.configuration().enable(new BarFeature());
| Method Summary | |
|---|---|
java.util.Collection<Feature> |
getFeatures()
Get the immutable set of enabled features. |
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Get the immutable bag of configuration properties. |
java.lang.Object |
getProperty(java.lang.String name)
Get the value for the property with a given name. |
java.util.Set<java.lang.Class<?>> |
getProviderClasses()
Get the immutable set of registered provider classes to be instantiated, injected and utilized in the scope of the configured instance. |
java.util.Set<java.lang.Object> |
getProviderInstances()
Get the immutable set of registered provider instances to be utilized by the configured instance. |
Configuration |
register(java.lang.Class<?> providerClass)
Register a feature or a provider class to be instantiated
and used in the scope of the configured instance. |
Configuration |
register(java.lang.Object provider)
Register a feature or a provider ("singleton") instance to be used
in the scope of the configured instance. |
Configuration |
setProperties(java.util.Map<java.lang.String,? extends java.lang.Object> properties)
Set new configuration properties replacing all previously set properties. |
Configuration |
setProperty(java.lang.String name,
java.lang.Object value)
Set the new configuration property, if already set, the existing value of the property will be updated. |
Configuration |
update(Configuration configuration)
Replace the existing configuration state with the configuration state of the externally provided configuration. |
| Method Detail |
|---|
java.util.Map<java.lang.String,java.lang.Object> getProperties()
Configurationjava.lang.Object getProperty(java.lang.String name)
name - property name.
null
if the property with such name is not configured.Configurationjava.util.Collection<Feature> getFeatures()
null.java.util.Set<java.lang.Class<?>> getProviderClasses()
Provider
annotation declared on the class that implements a specific service
interface.
null.getProviderInstances()java.util.Set<java.lang.Object> getProviderInstances()
null.getProviderClasses()Configuration update(Configuration configuration)
configuration - configuration to be used to update the instance.
Configuration register(java.lang.Class<?> providerClass)
feature or a provider class to be instantiated
and used in the scope of the configured instance.
As opposed to the providers registered by the
provider instances, providers
registered using this method are instantiated and properly injected
by the JAX-RS implementation provider. In case of a conflict between
a registered provider instance and instantiated registered provider class,
the registered provider instance takes precedence and the registered provider
class will not be instantiated in such case.
In case the registered provider is a client-side feature,
this Configuration object instantiates the feature and invokes the
Feature.onEnable(javax.ws.rs.client.Configuration) method and
lets the feature update it's internal configuration state. If the invocation
of Feature.onEnable(javax.ws.rs.client.Configuration) returns true
the feature is added to the collection of enabled features,
otherwise the feature instance is discarded.
providerClass - provider class to be instantiated and used in the scope
of the configured instance.
getProviderClasses()Configuration register(java.lang.Object provider)
feature or a provider ("singleton") instance to be used
in the scope of the configured instance.
As opposed to the providers registered by the
provider classes, provider instances
registered using this method are used "as is, i.e. are not managed or
injected by the JAX-RS implementation provider. In case of a conflict
between a registered provider instance and instantiated registered provider
class, the registered provider instance takes precedence and the registered
provider class will not be instantiated in such case.
In case the registered provider is a client-side feature,
this Configuration object invokes the
Feature.onEnable(javax.ws.rs.client.Configuration) method and
lets the feature update it's internal configuration state. If the invocation
of Feature.onEnable(javax.ws.rs.client.Configuration) returns true
the feature is added to the collection of enabled features,
otherwise the feature instance is discarded.
provider - a provider instance to be registered in the scope of the configured
instance.
getProviderInstances()Configuration setProperties(java.util.Map<java.lang.String,? extends java.lang.Object> properties)
properties - new set of configuration properties. The content of
the map will replace any existing properties set on the configurable
instance.
Configuration
Configuration setProperty(java.lang.String name,
java.lang.Object value)
null value into a property
effectively removes the property from the property bag.
name - property name.value - (new) property value. null value removes the property
with the given name.
Configuration
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||