|
||||||||||
| 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.
Configuration is inherited from a parent component to a child component.
When creating new 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().register(new BarFeature());
For a discussion on registering providers or narrowing down the scope of the
contracts registered for each provider, see configurable context documentation.
| Method Summary | ||
|---|---|---|
Configuration |
register(Class<?> providerClass)
Register a provider or a feature class to be instantiated
and used in the scope of the configured instance. |
|
Configuration |
register(Class<?> providerClass,
int bindingPriority)
Register a provider or a feature class to be instantiated and used
in the scope of the configured instance. |
|
|
register(Class<T> providerClass,
Class<? super T>... contracts)
Register a provider or a feature class to be instantiated
and used in the scope of the configured instance. |
|
|
register(Class<T> providerClass,
int bindingPriority,
Class<? super T>... contracts)
Register a provider or a feature class to be instantiated
and used in the scope of the configured instance. |
|
Configuration |
register(Object provider)
Register a provider or a feature ("singleton") instance to be used
in the scope of the configured instance. |
|
|
register(Object provider,
Class<? super T>... contracts)
Register a provider or a feature ("singleton") instance to be used
in the scope of the configured instance. |
|
Configuration |
register(Object provider,
int bindingPriority)
Register a provider or a feature ("singleton") instance to be used
in the scope of the configured instance. |
|
|
register(Object provider,
int bindingPriority,
Class<? super T>... contracts)
Register a provider or a feature ("singleton") instance to be used
in the scope of the configured instance. |
|
Configuration |
setProperties(Map<String,?> properties)
Set new configuration properties replacing all previously set properties. |
|
Configuration |
setProperty(String name,
Object value)
Set the new configuration property, if already set, the existing value of the property will be updated. |
|
Configuration |
updateFrom(Configurable configuration)
Replace the existing configuration state with the configuration state of the externally provided configuration. |
|
| Methods inherited from interface javax.ws.rs.core.Configurable |
|---|
getEnabledFeatures, getFeatureClasses, getFeatureInstances, getProperties, getProperty, getProviderClasses, getProviderInstances |
| Method Detail |
|---|
Configuration setProperties(Map<String,?> properties)
Configurable
setProperties in interface Configurableproperties - new set of configuration properties. The content of
the map will replace any existing properties set on the configurable
instance.
Configuration setProperty(String name,
Object value)
Configurablenull value into a property
effectively removes the property from the property bag.
setProperty in interface Configurablename - property name.value - (new) property value. null value removes the property
with the given name.
Configuration updateFrom(Configurable configuration)
configuration - configuration to be used to update the instance.
Configuration register(Class<?> providerClass)
Configurablefeature class to be instantiated
and used in the scope of the configured instance.
The registered class is registered as a provider of all the recognized JAX-RS or
implementation-specific extension contracts including Feature contract.
As opposed to the instances registered via Configurable.register(Object) method, classes
registered using this method are instantiated and properly injected
by the JAX-RS implementation provider. In case of a conflict between
a registered feature and/or provider instance and instantiated registered class,
the registered instance takes precedence and the registered class will not be
instantiated in such case.
register in interface ConfigurableproviderClass - provider class to be instantiated and used in the scope
of the configured instance.
Configuration register(Class<?> providerClass,
int bindingPriority)
Configurablefeature class to be instantiated and used
in the scope of the configured instance.
This registration method provides same functionality as Configurable.register(Class)
except that any provider binding priority specified on the provider class using
@BindingPriority annotation is overridden
with the supplied bindingPriority value.
Note that in case the binding priority is not applicable to any particular provider
contract registered for the provider class, the supplied bindingPriority value
will be ignored for that contract.
register in interface ConfigurableproviderClass - provider class to be instantiated and used in the scope
of the configured instance.bindingPriority - the overriding binding priority for the registered contract(s).
<T> Configuration register(Class<T> providerClass,
Class<? super T>... contracts)
Configurablefeature class to be instantiated
and used in the scope of the configured instance.
This registration method provides same functionality as Configurable.register(Class)
except the provider class is only registered as a provider of the listed
contracts. Note that in case the Feature interface is not listed
explicitly, the provider class is not recognized as a JAX-RS feature.
register in interface ConfigurableproviderClass - provider class to be instantiated and used in the scope
of the configured instance.contracts - the specific set of contracts implemented by the provider class
for which the provider should be registered. If omitted, the
provider class will be registered as a provider of all recognized
contracts implemented by the provider class.
<T> Configuration register(Class<T> providerClass,
int bindingPriority,
Class<? super T>... contracts)
Configurablefeature class to be instantiated
and used in the scope of the configured instance.
This registration method provides same functionality as Configurable.register(Class, Class[])
except that any provider binding priority specified on the provider class using
@BindingPriority annotation is overridden
with the supplied bindingPriority value.
Note that in case the binding priority is not applicable to any particular provider
contract registered for the provider class, the supplied bindingPriority value
will be ignored for that contract.
register in interface ConfigurableproviderClass - provider class to be instantiated and used in the scope
of the configured instance.bindingPriority - the overriding binding priority for the registered contract(s).contracts - the specific set of contracts implemented by the provider class
for which the provider should be registered. If omitted, the
provider class will be registered as a provider of all recognized
contracts implemented by the provider class.
Configuration register(Object provider)
Configurablefeature ("singleton") instance to be used
in the scope of the configured instance.
The registered instance is registered as a provider of all the recognized JAX-RS or
implementation-specific extension contracts including Feature contract.
As opposed to the instances registered via Configurable.register(Object) method, classes
registered using this method used "as is", i.e. are not managed or
injected by the JAX-RS implementation provider. In case of a conflict between
a registered feature and/or provider instance and instantiated registered class,
the registered instance takes precedence and the registered class will not be
instantiated in such case.
register in interface Configurableprovider - a provider instance to be registered in the scope of the configured
instance.
Configuration register(Object provider,
int bindingPriority)
Configurablefeature ("singleton") instance to be used
in the scope of the configured instance.
This registration method provides same functionality as Configurable.register(Object)
except that any provider binding priority specified on the provider using
@BindingPriority annotation is overridden
with the supplied bindingPriority value.
Note that in case the binding priority is not applicable to any particular provider
contract registered for the provider, the supplied bindingPriority value
will be ignored for that contract.
register in interface Configurableprovider - provider class to be instantiated and used in the scope
of the configured instance.bindingPriority - the overriding binding priority for the registered contract(s).
<T> Configuration register(Object provider,
Class<? super T>... contracts)
Configurablefeature ("singleton") instance to be used
in the scope of the configured instance.
This registration method provides same functionality as Configurable.register(Object)
except the provider is only registered as a provider of the listed
contracts. Note that in case the Feature interface is not listed
explicitly, the provider is not recognized as a JAX-RS feature.
register in interface Configurableprovider - a provider instance to be registered in the scope of the configured
instance.contracts - the specific set of contracts implemented by the provider class
for which the provider should be registered. If omitted, the
provider class will be registered as a provider of all recognized
contracts implemented by the provider class.
<T> Configuration register(Object provider,
int bindingPriority,
Class<? super T>... contracts)
Configurablefeature ("singleton") instance to be used
in the scope of the configured instance.
This registration method provides same functionality as Configurable.register(Object, Class[])
except that any provider binding priority specified on the provider using
@BindingPriority annotation is overridden
with the supplied bindingPriority value.
Note that in case the binding priority is not applicable to any particular provider
contract registered for the provider, the supplied bindingPriority value
will be ignored for that contract.
register in interface Configurableprovider - a provider instance to be registered in the scope of the configured
instance.bindingPriority - the overriding binding priority for the registered contract(s).contracts - the specific set of contracts implemented by the provider class
for which the provider should be registered. If omitted, the
provider class will be registered as a provider of all recognized
contracts implemented by the provider class.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||