org.apache.myfaces.extensions.cdi.jsf2.impl.scope.view
Class ViewScopedContext
java.lang.Object
org.apache.myfaces.extensions.cdi.jsf2.impl.scope.view.ViewScopedContext
- All Implemented Interfaces:
- EventListener, javax.enterprise.context.spi.Context, javax.faces.event.FacesListener, javax.faces.event.SystemEventListener
- Direct Known Subclasses:
- MockViewScopedContext
public class ViewScopedContext
- extends Object
- implements javax.enterprise.context.spi.Context, javax.faces.event.SystemEventListener
This class provides the contexts lifecycle for the
new JSF-2 @ViewScoped Context
Method Summary |
|
get(javax.enterprise.context.spi.Contextual<T> component)
|
|
get(javax.enterprise.context.spi.Contextual<T> component,
javax.enterprise.context.spi.CreationalContext<T> creationalContext)
|
Class<? extends Annotation> |
getScope()
|
protected Map<String,Object> |
getViewMap()
|
protected javax.faces.component.UIViewRoot |
getViewRoot()
|
boolean |
isActive()
The view context is active if a valid ViewRoot could be detected. |
boolean |
isListenerForSource(Object source)
|
void |
processEvent(javax.faces.event.SystemEvent event)
We get PreDestroyViewMapEvent events from the JSF servlet and destroy our contextual
instances. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ViewScopedContext
public ViewScopedContext()
get
public <T> T get(javax.enterprise.context.spi.Contextual<T> component)
- Specified by:
get
in interface javax.enterprise.context.spi.Context
get
public <T> T get(javax.enterprise.context.spi.Contextual<T> component,
javax.enterprise.context.spi.CreationalContext<T> creationalContext)
- Specified by:
get
in interface javax.enterprise.context.spi.Context
getScope
public Class<? extends Annotation> getScope()
- Specified by:
getScope
in interface javax.enterprise.context.spi.Context
isActive
public boolean isActive()
- The view context is active if a valid ViewRoot could be detected.
- Specified by:
isActive
in interface javax.enterprise.context.spi.Context
isListenerForSource
public boolean isListenerForSource(Object source)
- Specified by:
isListenerForSource
in interface javax.faces.event.SystemEventListener
processEvent
public void processEvent(javax.faces.event.SystemEvent event)
- We get PreDestroyViewMapEvent events from the JSF servlet and destroy our contextual
instances. This should (theoretically!) also get fired if the webapp closes, so there
should be no need to manually track all view scopes and destroy them at a shutdown.
- Specified by:
processEvent
in interface javax.faces.event.SystemEventListener
- See Also:
SystemEventListener.processEvent(javax.faces.event.SystemEvent)
getViewRoot
protected javax.faces.component.UIViewRoot getViewRoot()
getViewMap
protected Map<String,Object> getViewMap()
Copyright © 2010-2011 The Apache Software Foundation. All Rights Reserved.