Package org.apache.myfaces.cdi
Class FacesScopeContext
- java.lang.Object
-
- org.apache.myfaces.cdi.FacesScopeContext
-
- All Implemented Interfaces:
javax.enterprise.context.spi.Context
@Typed public class FacesScopeContext extends Object implements javax.enterprise.context.spi.Context
Minimal implementation of FacesScope.
-
-
Field Summary
Fields Modifier and Type Field Description static StringFACES_SCOPE_MAP
-
Constructor Summary
Constructors Constructor Description FacesScopeContext(javax.enterprise.inject.spi.BeanManager beanManager)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckActive(FacesContext facesContext)Make sure that the Context is really active.booleandestroy(javax.enterprise.context.spi.Contextual bean)Destroy the Contextual Instance of the given Bean.static voiddestroyAllActive(FacesContext facesContext)This method properly destroys all current @FacesScoped beans of the active session and also prepares the storage for new beans.<T> Tget(javax.enterprise.context.spi.Contextual<T> bean)<T> Tget(javax.enterprise.context.spi.Contextual<T> bean, javax.enterprise.context.spi.CreationalContext<T> creationalContext)protected ContextualStoragegetContextualStorage(boolean createIfNotExist, FacesContext facesContext)An implementation has to return the underlying storage which contains the items held in the Context.Class<? extends Annotation>getScope()booleanisActive()
-
-
-
Field Detail
-
FACES_SCOPE_MAP
public static final String FACES_SCOPE_MAP
- See Also:
- Constant Field Values
-
-
Method Detail
-
getContextualStorage
protected ContextualStorage getContextualStorage(boolean createIfNotExist, FacesContext facesContext)
An implementation has to return the underlying storage which contains the items held in the Context.- Parameters:
createIfNotExist- whether a ContextualStorage shall get created if it doesn't yet exist.facesContext-- Returns:
- the underlying storage
-
getScope
public Class<? extends Annotation> getScope()
- Specified by:
getScopein interfacejavax.enterprise.context.spi.Context
-
isActive
public boolean isActive()
- Specified by:
isActivein interfacejavax.enterprise.context.spi.Context
-
get
public <T> T get(javax.enterprise.context.spi.Contextual<T> bean)
- Specified by:
getin interfacejavax.enterprise.context.spi.Context
-
get
public <T> T get(javax.enterprise.context.spi.Contextual<T> bean, javax.enterprise.context.spi.CreationalContext<T> creationalContext)- Specified by:
getin interfacejavax.enterprise.context.spi.Context
-
destroy
public boolean destroy(javax.enterprise.context.spi.Contextual bean)
Destroy the Contextual Instance of the given Bean.- Parameters:
bean- dictates which bean shall get cleaned up- Returns:
trueif the bean was destroyed,falseif there was no such bean.
-
checkActive
protected void checkActive(FacesContext facesContext)
Make sure that the Context is really active.- Parameters:
facesContext-- Throws:
javax.enterprise.context.ContextNotActiveException- if there is no active Context for the current Thread.
-
destroyAllActive
public static void destroyAllActive(FacesContext facesContext)
This method properly destroys all current @FacesScoped beans of the active session and also prepares the storage for new beans. It will automatically get called when the session context closes but can also get invoked manually, e.g. if a user likes to get rid of all it's @FacesScoped beans.- Parameters:
facesContext-
-
-