org.apache.myfaces.cdi.view
Class ViewScopeBeanHolder
java.lang.Object
org.apache.myfaces.cdi.view.ViewScopeBeanHolder
- All Implemented Interfaces:
- Serializable
@SessionScoped
public class ViewScopeBeanHolder
- extends Object
- implements Serializable
- Author:
- Leonardo Uribe
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
VIEW_SCOPE_PREFIX_KEY
public static final String VIEW_SCOPE_PREFIX_KEY
- See Also:
- Constant Field Values
ViewScopeBeanHolder
public ViewScopeBeanHolder()
init
@PostConstruct
public void init()
getContextualStorage
public ViewScopeContextualStorage getContextualStorage(javax.enterprise.inject.spi.BeanManager beanManager,
String viewScopeId)
- This method will return the ViewScopeContextualStorage or create a new one
if no one is yet assigned to the current windowId.
- Parameters:
beanManager
- we need the CDI BeanManager
for serialisation.windowId
- the windowId for the current browser tab or window.
getStorageMap
public Map<String,ViewScopeContextualStorage> getStorageMap()
forceNewStorage
public Map<String,ViewScopeContextualStorage> forceNewStorage()
- This method will replace the storageMap and with
a new empty one.
This method can be used to properly destroy the WindowBeanHolder beans
without having to sync heavily. Any
Contextual.destroy(Object, javax.enterprise.context.spi.CreationalContext)
should be performed on the returned old storage map.
- Returns:
- the old storageMap.
destroyBeans
public void destroyBeans()
- This method properly destroys all current @WindowScoped 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 @ViewScoped beans.
destroyBeans
public void destroyBeans(String viewScopeId)
destroyBeansOnPreDestroy
@PreDestroy
public void destroyBeansOnPreDestroy()
generateUniqueViewScopeId
public String generateUniqueViewScopeId()
Copyright © 2014 The Apache Software Foundation. All rights reserved.