Class CommonScopeProvider
- java.lang.Object
-
- org.glassfish.jersey.message.filtering.CommonScopeProvider
-
- All Implemented Interfaces:
ScopeProvider
- Direct Known Subclasses:
ServerScopeProvider
@Singleton class CommonScopeProvider extends java.lang.Object implements ScopeProvider
Default implementation ofscope provider
. This class can be used on client to retrieve entity-filtering scopes from given entity annotations or injectedconfiguration
. Class can also serve as a base class for server-side implementations.- See Also:
ServerScopeProvider
-
-
Field Summary
Fields Modifier and Type Field Description private javax.ws.rs.core.Configuration
config
private static java.util.logging.Logger
LOGGER
private java.util.List<ScopeResolver>
resolvers
-
Fields inherited from interface org.glassfish.jersey.message.filtering.spi.ScopeProvider
DEFAULT_SCOPE
-
-
Constructor Summary
Constructors Constructor Description CommonScopeProvider(javax.ws.rs.core.Configuration config, InjectionManager injectionManager)
Create new common scope provider with injectedconfiguration
andinjection manager
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Set<java.lang.String>
getFilteringScopes(java.lang.annotation.Annotation[] annotations)
Get entity-filtering scopes from all availablescope resolvers
for given annotations.java.util.Set<java.lang.String>
getFilteringScopes(java.lang.annotation.Annotation[] entityAnnotations, boolean defaultIfNotFound)
Get entity-filtering scopes to be used to process an entity.private java.util.Set<java.lang.String>
getFilteringScopes(javax.ws.rs.core.Configuration config)
Get entity-filtering scopes fromConfiguration
.protected void
mergeFilteringScopes(java.util.Set<java.lang.String> filteringScopes, java.util.Set<java.lang.String> resolvedScopes)
Merge two sets of entity-filtering scopes.protected java.util.Set<java.lang.String>
returnFilteringScopes(java.util.Set<java.lang.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 Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
resolvers
private final java.util.List<ScopeResolver> resolvers
-
config
private final javax.ws.rs.core.Configuration config
-
-
Constructor Detail
-
CommonScopeProvider
@Inject public CommonScopeProvider(javax.ws.rs.core.Configuration config, InjectionManager injectionManager)
Create new common scope provider with injectedconfiguration
andinjection manager
.
-
-
Method Detail
-
getFilteringScopes
public java.util.Set<java.lang.String> getFilteringScopes(java.lang.annotation.Annotation[] entityAnnotations, boolean defaultIfNotFound)
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 java.util.Set<java.lang.String> returnFilteringScopes(java.util.Set<java.lang.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
protected java.util.Set<java.lang.String> getFilteringScopes(java.lang.annotation.Annotation[] annotations)
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
private java.util.Set<java.lang.String> getFilteringScopes(javax.ws.rs.core.Configuration config)
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
protected void mergeFilteringScopes(java.util.Set<java.lang.String> filteringScopes, java.util.Set<java.lang.String> resolvedScopes)
Merge two sets of entity-filtering scopes.- Parameters:
filteringScopes
- existing entity-filtering scopes.resolvedScopes
- entity-filtering scopes to be added to the existing ones.
-
-