Package com.sun.faces.application.view
Class ViewScopeManager
- java.lang.Object
-
- com.sun.faces.application.view.ViewScopeManager
-
- All Implemented Interfaces:
FacesListener
,SystemEventListener
,ViewMapListener
,jakarta.servlet.http.HttpSessionListener
,EventListener
public class ViewScopeManager extends Object implements jakarta.servlet.http.HttpSessionListener, ViewMapListener
The manager that deals with non-CDI and CDI ViewScoped beans.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ACTIVE_VIEW_MAPS
Stores the constants to keep track of the active view maps.static String
ACTIVE_VIEW_MAPS_SIZE
Stores the constant for the maximum active view map size.static String
VIEW_MAP
Stores the view map.static String
VIEW_MAP_ID
Stores the view map id.static String
VIEW_SCOPE_MANAGER
Stores the constant to keep track of the ViewScopeManager.
-
Constructor Summary
Constructors Constructor Description ViewScopeManager()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clear(FacesContext facesContext)
Clear the current view map using the Faces context.void
clear(FacesContext facesContext, String viewMapId, Map<String,Object> viewMap)
Clear the given view map.void
clear(FacesContext facesContext, Map<String,Object> viewMap)
Deprecated.void
destroyBeans(FacesContext facesContext, Map<String,Object> viewMap)
Destroy the managed beans from the given view map.static ViewScopeManager
getInstance(FacesContext facesContext)
Get our instance.boolean
isListenerForSource(Object source)
Is a listener for the given source.protected static String
locateViewMapId(FacesContext facesContext, Map<String,Object> viewMap)
Static method that locates the ID for a view map in the active view maps stored in the session.void
processEvent(SystemEvent systemEvent)
Process the system event.void
sessionCreated(jakarta.servlet.http.HttpSessionEvent se)
Create the associated data in the session (if any).void
sessionDestroyed(jakarta.servlet.http.HttpSessionEvent httpSessionEvent)
Destroy the associated data in the session.
-
-
-
Field Detail
-
ACTIVE_VIEW_MAPS
public static final String ACTIVE_VIEW_MAPS
Stores the constants to keep track of the active view maps.- See Also:
- Constant Field Values
-
ACTIVE_VIEW_MAPS_SIZE
public static final String ACTIVE_VIEW_MAPS_SIZE
Stores the constant for the maximum active view map size.- See Also:
- Constant Field Values
-
VIEW_MAP
public static final String VIEW_MAP
Stores the view map.- See Also:
- Constant Field Values
-
VIEW_MAP_ID
public static final String VIEW_MAP_ID
Stores the view map id.- See Also:
- Constant Field Values
-
VIEW_SCOPE_MANAGER
public static final String VIEW_SCOPE_MANAGER
Stores the constant to keep track of the ViewScopeManager.- See Also:
- Constant Field Values
-
-
Method Detail
-
locateViewMapId
protected static String locateViewMapId(FacesContext facesContext, Map<String,Object> viewMap)
Static method that locates the ID for a view map in the active view maps stored in the session. It just performs a == over the view map because it should be the same object.- Parameters:
facesContext
- The faces contextviewMap
- The view to locate- Returns:
- located ID
-
clear
public void clear(FacesContext facesContext)
Clear the current view map using the Faces context.- Parameters:
facesContext
- the Faces context.
-
clear
@Deprecated public void clear(FacesContext facesContext, Map<String,Object> viewMap)
Deprecated.Clear the given view map. Use the version with viewMapId.- Parameters:
facesContext
- the Faces context.viewMap
- the view map.
-
clear
public void clear(FacesContext facesContext, String viewMapId, Map<String,Object> viewMap)
Clear the given view map.- Parameters:
facesContext
- the Faces context.viewMapId
- The ID of the view mapviewMap
- the view map.
-
destroyBeans
public void destroyBeans(FacesContext facesContext, Map<String,Object> viewMap)
Destroy the managed beans from the given view map.- Parameters:
facesContext
- the Faces Context.viewMap
- the view map.
-
getInstance
public static ViewScopeManager getInstance(FacesContext facesContext)
Get our instance.- Parameters:
facesContext
- the FacesContext.- Returns:
- our instance.
-
isListenerForSource
public boolean isListenerForSource(Object source)
Is a listener for the given source.- Specified by:
isListenerForSource
in interfaceSystemEventListener
- Parameters:
source
- the source.- Returns:
- true if UIViewRoot, false otherwise.
-
processEvent
public void processEvent(SystemEvent systemEvent) throws AbortProcessingException
Process the system event.- Specified by:
processEvent
in interfaceSystemEventListener
- Parameters:
systemEvent
- the system event.- Throws:
AbortProcessingException
- when processing needs to be aborted.
-
sessionCreated
public void sessionCreated(jakarta.servlet.http.HttpSessionEvent se)
Create the associated data in the session (if any).- Specified by:
sessionCreated
in interfacejakarta.servlet.http.HttpSessionListener
- Parameters:
se
- the HTTP session event.
-
sessionDestroyed
public void sessionDestroyed(jakarta.servlet.http.HttpSessionEvent httpSessionEvent)
Destroy the associated data in the session.- Specified by:
sessionDestroyed
in interfacejakarta.servlet.http.HttpSessionListener
- Parameters:
httpSessionEvent
- the HTTP session event.
-
-