Class CommonScopeProvider
java.lang.Object
org.glassfish.jersey.message.filtering.CommonScopeProvider
- All Implemented Interfaces:
ScopeProvider
- Direct Known Subclasses:
ServerScopeProvider
Default implementation of
scope provider
. This class can be used on client to retrieve
entity-filtering scopes from given entity annotations or injected configuration
. Class can also serve
as a base class for server-side implementations.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final javax.ws.rs.core.Configuration
private static final Logger
private final List<ScopeResolver>
Fields inherited from interface org.glassfish.jersey.message.filtering.spi.ScopeProvider
DEFAULT_SCOPE
-
Constructor Summary
ConstructorsConstructorDescriptionCommonScopeProvider
(javax.ws.rs.core.Configuration config, InjectionManager injectionManager) Create new common scope provider with injectedconfiguration
andinjection manager
. -
Method Summary
Modifier and TypeMethodDescriptiongetFilteringScopes
(Annotation[] annotations) Get entity-filtering scopes from all availablescope resolvers
for given annotations.getFilteringScopes
(Annotation[] entityAnnotations, boolean defaultIfNotFound) Get entity-filtering scopes to be used to process an entity.getFilteringScopes
(javax.ws.rs.core.Configuration config) Get entity-filtering scopes fromConfiguration
.protected void
mergeFilteringScopes
(Set<String> filteringScopes, Set<String> resolvedScopes) Merge two sets of entity-filtering scopes.returnFilteringScopes
(Set<String> filteringScopes, boolean returnDefaultFallback) Return the default entity-filtering scope if the given set of scopes is empty and the processing should fallback to the default.
-
Field Details
-
LOGGER
-
resolvers
-
config
private final javax.ws.rs.core.Configuration config
-
-
Constructor Details
-
CommonScopeProvider
@Inject public CommonScopeProvider(javax.ws.rs.core.Configuration config, InjectionManager injectionManager) Create new common scope provider with injectedconfiguration
andinjection manager
.
-
-
Method Details
-
getFilteringScopes
Description copied from interface:ScopeProvider
Get entity-filtering scopes to be used to process an entity.- Specified by:
getFilteringScopes
in interfaceScopeProvider
- Parameters:
entityAnnotations
- entity annotations provided with entity when creating request/response.defaultIfNotFound
- flag determining whether the default entity-filtering scope should be returned if no other scope can be obtained.- Returns:
- non-null entity-filtering scopes.
-
returnFilteringScopes
protected Set<String> returnFilteringScopes(Set<String> filteringScopes, boolean returnDefaultFallback) Return the default entity-filtering scope if the given set of scopes is empty and the processing should fallback to the default.- Parameters:
filteringScopes
- entity-filtering scopes to be examined.returnDefaultFallback
-true
if the default entity-filtering scope should be returned if the given scopes are empty,false
otherwise.- Returns:
- entity-filtering scopes.
-
getFilteringScopes
Get entity-filtering scopes from all availablescope resolvers
for given annotations.- Parameters:
annotations
- annotations to retrieve entity-filtering scopes from.- Returns:
- entity-filtering scopes or an empty set if none scope can be resolved.
-
getFilteringScopes
Get entity-filtering scopes fromConfiguration
.- Parameters:
config
- configuration the entity-filtering scopes are obtained from.- Returns:
- entity-filtering scopes or an empty set if none scope can be resolved.
-
mergeFilteringScopes
Merge two sets of entity-filtering scopes.- Parameters:
filteringScopes
- existing entity-filtering scopes.resolvedScopes
- entity-filtering scopes to be added to the existing ones.
-