@ApplicationScoped public class ViewScopeManager extends Object
ViewScopeContext
which is
registered by ViewScopeExtension
and the destroy is initiated by ViewScopeEventListener
which is
registered in faces-config.xml
.
Depending on ViewScoped.saveInViewState()
, this view scope manager will delegate the creation and destroy
further to either ViewScopeStorageInSession
or ViewScopeStorageInViewState
which saves the concrete
bean instances in respectively HTTP session or JSF view state.
ViewScoped
,
ViewScopeContext
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_ACTIVE_VIEW_SCOPES
Default value of maximum active view scopes in session.
|
static String |
PARAM_NAME_MAX_ACTIVE_VIEW_SCOPES
OmniFaces specific context parameter name of maximum active view scopes in session.
|
static String |
PARAM_NAME_MOJARRA_NUMBER_OF_VIEWS
Mojarra specific context parameter name of maximum number of logical views in session.
|
static String |
PARAM_NAME_MYFACES_NUMBER_OF_VIEWS
MyFaces specific context parameter name of maximum number of views in session.
|
Constructor and Description |
---|
ViewScopeManager() |
Modifier and Type | Method and Description |
---|---|
<T> T |
createBean(Contextual<T> type,
CreationalContext<T> context)
Create and returns the CDI view scoped managed bean from the current JSF view scope.
|
<T> T |
getBean(Contextual<T> type)
Returns the CDI view scoped managed bean from the current JSF view scope.
|
static boolean |
isUnloadRequest(FacesContext context)
Returns
true if the current request is triggered by an unload request. |
static boolean |
isUnloadRequest(HttpServletRequest request)
Returns
true if the given request is triggered by an unload request. |
void |
preDestroyView()
This method is invoked during view destroy by
ViewScopeEventListener , in that case destroy all beans in
current active view scope. |
public static final String PARAM_NAME_MAX_ACTIVE_VIEW_SCOPES
public static final String PARAM_NAME_MOJARRA_NUMBER_OF_VIEWS
public static final String PARAM_NAME_MYFACES_NUMBER_OF_VIEWS
public static final int DEFAULT_MAX_ACTIVE_VIEW_SCOPES
public <T> T createBean(Contextual<T> type, CreationalContext<T> context)
T
- The expected return type.type
- The contextual type of the CDI managed bean.context
- The CDI context to create the CDI managed bean in.public <T> T getBean(Contextual<T> type)
T
- The expected return type.type
- The contextual type of the CDI managed bean.public void preDestroyView()
ViewScopeEventListener
, in that case destroy all beans in
current active view scope.public static boolean isUnloadRequest(FacesContext context)
true
if the current request is triggered by an unload request.context
- The involved faces context.true
if the current request is triggered by an unload request.public static boolean isUnloadRequest(HttpServletRequest request)
true
if the given request is triggered by an unload request.request
- The involved request.true
if the given request is triggered by an unload request.Copyright © 2012–2018 OmniFaces. All rights reserved.