Class CommonConfig
java.lang.Object
org.glassfish.jersey.model.internal.CommonConfig
- All Implemented Interfaces:
javax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>,javax.ws.rs.core.Configuration,javax.ws.rs.core.FeatureContext,ExtendedConfig
- Direct Known Subclasses:
ImmutableCommonConfig,ResourceConfig.State,ResourceMethodConfig
Common immutable
Configuration implementation for
server and client.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classA single feature registration record. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ComponentBagConfigured providers, does not include features and binders.private booleanFlag determining whether the configuration of meta-providers (excl.Collection of enabled feature classes.private final Set<javax.ws.rs.core.Feature> Collection of enabled feature instances.private final Collection<String> private static final Loggerprivate final List<CommonConfig.FeatureRegistration> Collection of unprocessed feature registrations.Configuration properties collection and it's immutable views.private final javax.ws.rs.RuntimeTypeConfiguration runtime type. -
Constructor Summary
ConstructorsConstructorDescriptionCommonConfig(javax.ws.rs.RuntimeType type, Predicate<ContractProvider> registrationStrategy) Create a newRuntimeConfiginstance.CommonConfig(CommonConfig config) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionaddProperties(Map<String, ?> properties) Add properties toResourceConfig.asNewIdentitySet(Class<?>... contracts) private voidcheckComponentClassNotNull(Class<?> componentClass) private voidcheckProviderNotNull(Object provider) voidconfigureAutoDiscoverableProviders(InjectionManager injectionManager, Collection<AutoDiscoverable> autoDiscoverables, boolean forcedOnly) Configureauto-discoverablesin the injection manager.configureBinders(InjectionManager injectionManager, Set<Binder> configured) private voidconfigureExternalObjects(InjectionManager injectionManager) private voidconfigureFeatures(InjectionManager injectionManager, Set<CommonConfig.FeatureRegistration> processed, List<CommonConfig.FeatureRegistration> unprocessed, ManagedObjectsFinalizer managedObjectsFinalizer) voidconfigureMetaProviders(InjectionManager injectionManager, ManagedObjectsFinalizer finalizer) Configure binders in the injection manager and enable JAX-RS features.private voidcopy(CommonConfig config, boolean loadComponentBag) Copy config properties, providers from givenconfigto this instance.booleanprivate Collection<Binder> final ComponentBagReturns aComponentBaginstance associated with the configuration.getContracts(Class<?> componentClass) protected Inflector<ContractProvider.Builder, ContractProvider> getModelEnhancer(Class<?> componentClass) An extension point that provides a way how to define a custom enhancement/update operation of a contract provider model registration being produced for a given component class.getProperty(String name) javax.ws.rs.RuntimeTypeinthashCode()booleanbooleanisEnabled(javax.ws.rs.core.Feature feature) booleanisProperty(String name) Get the value of the property with a given name converted toboolean.booleanisRegistered(Class<?> componentClass) booleanisRegistered(Object component) loadFrom(javax.ws.rs.core.Configuration config) Load the internal configuration state from an externally provided configuration state.private voidprocessFeatureRegistration(Object component, Class<?> componentClass) private List<CommonConfig.FeatureRegistration> setProperties(Map<String, ?> properties) Set the configured properties to the provided map of properties.
-
Field Details
-
LOGGER
-
CAST_TO_BINDER
-
type
private final javax.ws.rs.RuntimeType typeConfiguration runtime type. -
properties
Configuration properties collection and it's immutable views. -
immutablePropertiesView
-
immutablePropertyNames
-
componentBag
Configured providers, does not include features and binders. -
newFeatureRegistrations
Collection of unprocessed feature registrations. -
enabledFeatureClasses
Collection of enabled feature classes. -
enabledFeatures
Collection of enabled feature instances. -
disableMetaProviderConfiguration
private boolean disableMetaProviderConfigurationFlag determining whether the configuration of meta-providers (excl. binders) should be disabled.
-
-
Constructor Details
-
CommonConfig
Create a newRuntimeConfiginstance.The constructor provides a way for defining a
contract provider modelregistration strategy. Once a registration model is built for a newly registered contract, the provided registration strategy filter is consulted whether the model should be registered or not.Clients can use the method to cancel any contract provider model registration that does not meet the criteria of a given configuration context, such as a model that does not have any recognized contracts associated with it.
- Parameters:
type- configuration runtime type.registrationStrategy- function driving the decision (based on the introspectedcontract provider model) whether or not should the component class registration continue towards a successful completion.
-
CommonConfig
Copy constructor.- Parameters:
config- configurable to copy class properties from.
-
-
Method Details
-
copy
Copy config properties, providers from givenconfigto this instance.- Parameters:
config- configurable to copy class properties from.loadComponentBag-trueif the component bag from config should be copied as well,falseotherwise.
-
getConfiguration
- Specified by:
getConfigurationin interfacejavax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
-
getRuntimeType
public javax.ws.rs.RuntimeType getRuntimeType()- Specified by:
getRuntimeTypein interfacejavax.ws.rs.core.Configuration
-
getProperties
- Specified by:
getPropertiesin interfacejavax.ws.rs.core.Configuration
-
getProperty
- Specified by:
getPropertyin interfacejavax.ws.rs.core.Configuration
-
isProperty
Description copied from interface:ExtendedConfigGet the value of the property with a given name converted toboolean. Returnsfalseif the value is not convertible.- Specified by:
isPropertyin interfaceExtendedConfig- Parameters:
name- property name.- Returns:
booleanproperty value orfalseif the property is not convertible.
-
getPropertyNames
- Specified by:
getPropertyNamesin interfacejavax.ws.rs.core.Configuration
-
isEnabled
- Specified by:
isEnabledin interfacejavax.ws.rs.core.Configuration
-
isEnabled
public boolean isEnabled(javax.ws.rs.core.Feature feature) - Specified by:
isEnabledin interfacejavax.ws.rs.core.Configuration
-
isRegistered
- Specified by:
isRegisteredin interfacejavax.ws.rs.core.Configuration
-
isRegistered
- Specified by:
isRegisteredin interfacejavax.ws.rs.core.Configuration
-
getContracts
- Specified by:
getContractsin interfacejavax.ws.rs.core.Configuration
-
getClasses
- Specified by:
getClassesin interfacejavax.ws.rs.core.Configuration
-
getInstances
- Specified by:
getInstancesin interfacejavax.ws.rs.core.Configuration
-
getComponentBag
Returns aComponentBaginstance associated with the configuration.- Returns:
- a non-null component bag instance.
-
getModelEnhancer
protected Inflector<ContractProvider.Builder,ContractProvider> getModelEnhancer(Class<?> componentClass) An extension point that provides a way how to define a custom enhancement/update operation of a contract provider model registration being produced for a given component class. Default implementation return an enhancer just builds the model.Derived implementations may use this method to e.g. filter out all contracts not applicable in the given configuration context or change the model scope. The returned set of filtered contracts is then used for the actual provider registration.
- Parameters:
componentClass- class of the component being registered.- Returns:
- filter for the contracts that being registered for a given component class.
-
setProperties
Set the configured properties to the provided map of properties.- Parameters:
properties- new map of properties to be set.- Returns:
- updated configuration instance.
-
addProperties
Add properties toResourceConfig. If any of the added properties exists already, he values of the existing properties will be replaced with new values.- Parameters:
properties- properties to add.- Returns:
- updated configuration instance.
-
property
- Specified by:
propertyin interfacejavax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
-
register
- Specified by:
registerin interfacejavax.ws.rs.core.Configurable<javax.ws.rs.core.FeatureContext>
-
processFeatureRegistration
-
loadFrom
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. If the features, auto-discoverables of given config has been already configured then this method will make sure to not configure them for the second time.- Parameters:
config- external configuration state to replace the configuration of this configurable instance.- Returns:
- the updated common configuration instance.
-
asNewIdentitySet
-
checkProviderNotNull
-
checkComponentClassNotNull
-
configureAutoDiscoverableProviders
public void configureAutoDiscoverableProviders(InjectionManager injectionManager, Collection<AutoDiscoverable> autoDiscoverables, boolean forcedOnly) Configureauto-discoverablesin the injection manager.- Parameters:
injectionManager- injection manager in which the auto-discoverables should be configured.autoDiscoverables- list of registered auto discoverable components.forcedOnly- defines whether all or only forced auto-discoverables should be configured.
-
configureMetaProviders
public void configureMetaProviders(InjectionManager injectionManager, ManagedObjectsFinalizer finalizer) Configure binders in the injection manager and enable JAX-RS features.- Parameters:
injectionManager- injection manager in which the binders and features should be configured.
-
configureBinders
-
getBinder
-
configureExternalObjects
-
configureFeatures
private void configureFeatures(InjectionManager injectionManager, Set<CommonConfig.FeatureRegistration> processed, List<CommonConfig.FeatureRegistration> unprocessed, ManagedObjectsFinalizer managedObjectsFinalizer) -
resetRegistrations
-
equals
-
hashCode
public int hashCode()
-