Top Description Fields Constructors Methods
com.sun.faces.application.view

public Class ViewScopeManager

extends Object
implements HttpSessionListener, ViewMapListener
Class Inheritance
All Implemented Interfaces
jakarta.faces.event.ViewMapListener, jakarta.faces.event.SystemEventListener, jakarta.faces.event.FacesListener, java.util.EventListener, jakarta.servlet.http.HttpSessionListener
Static Imports
com.sun.faces.config.WebConfiguration.BooleanWebContextInitParameter.EnableDistributable, .WebConfiguration.WebContextInitParameter.NumberOfActiveViewMaps, java.util.logging.Level.FINEST, .Level.WARNING

The manager that deals with non-CDI and CDI ViewScoped beans.

Field Summary

Modifier and TypeField and Description
public static final String
ACTIVE_VIEW_MAPS

Stores the constants to keep track of the active view maps.

public static final String
ACTIVE_VIEW_MAPS_SIZE

Stores the constant for the maximum active view map size.

private final ViewScopeContextManager
contextManager

Stores the CDI context manager.

private final boolean
private static final Logger
LOGGER

Stores the logger.

private Integer
public static final String
VIEW_MAP

Stores the view map.

public static final String
VIEW_MAP_ID

Stores the view map id.

public static final String
VIEW_SCOPE_MANAGER

Stores the constant to keep track of the ViewScopeManager.

Constructor Summary

AccessConstructor and Description
public
ViewScopeManager()

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
clear(FacesContext
the Faces context.
facesContext
)

Clear the current view map using the Faces context.

public void
clear(FacesContext
the Faces context.
facesContext
,
Map<String, Object>
the view map.
viewMap
)
Deprecated

Clear the given view map.

public void
clear(FacesContext
the Faces context.
facesContext
,
String
The ID of the view map
viewMapId
,
Map<String, Object>
the view map.
viewMap
)

Clear the given view map.

public void
destroyBeans(FacesContext
the Faces Context.
facesContext
,
Map<String, Object>
the view map.
viewMap
)

Destroy the managed beans from the given view map.

private void
destroyBeans(ApplicationAssociate
the application associate.
applicationAssociate
,
Map<String, Object>
the view map.
viewMap
)

Destroy the managed beans from the given view map.

pack-priv ViewScopeContextManager

Returns:

the CDI context manager.
getContextManager
()

Get the CDI context manager.

public static ViewScopeManager

Returns:

our instance.
getInstance
(FacesContext
the FacesContext.
facesContext
)

Get our instance.

public boolean

Returns:

true if UIViewRoot, false otherwise.
isListenerForSource
(Object
the source.
source
)

Implements jakarta.faces.event.SystemEventListener.isListenerForSource.

Is a listener for the given source.

protected static String

Returns:

located ID
locateViewMapId
(FacesContext
The faces context
facesContext
,
Map<String, Object>
The view to locate
viewMap
)

Static method that locates the ID for a view map in the active view maps stored in the session.

public void
processEvent(SystemEvent
the system event.
systemEvent
)

Implements jakarta.faces.event.SystemEventListener.processEvent.

Process the system event.

private void
processPostConstructViewMap(SystemEvent
the system event.
systemEvent
)

Process the PostConstructViewMap system event.

private void
processPreDestroyViewMap(SystemEvent
the system event.
se
)

Process the PreDestroyViewMap system event.

private void
removeEldestViewMap(FacesContext
the context
facesContext
,
String
the view map id
viewMapId
,
Map<String, Object>
the eldest view map.
eldestViewMap
)

Remove the eldest view map from the active view maps.

public void
sessionCreated(HttpSessionEvent
the HTTP session event.
se
)

Overrides default jakarta.servlet.http.HttpSessionListener.sessionCreated.

Create the associated data in the session (if any).

public void
sessionDestroyed(HttpSessionEvent
the HTTP session event.
httpSessionEvent
)

Overrides default jakarta.servlet.http.HttpSessionListener.sessionDestroyed.

Destroy the associated data in the session.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ACTIVE_VIEW_MAPSback to summary
public static final String ACTIVE_VIEW_MAPS

Stores the constants to keep track of the active view maps.

ACTIVE_VIEW_MAPS_SIZEback to summary
public static final String ACTIVE_VIEW_MAPS_SIZE

Stores the constant for the maximum active view map size.

contextManagerback to summary
private final ViewScopeContextManager contextManager

Stores the CDI context manager.

distributableback to summary
private final boolean distributable
LOGGERback to summary
private static final Logger LOGGER

Stores the logger.

numberOfActiveViewMapsInWebXmlback to summary
private Integer numberOfActiveViewMapsInWebXml
VIEW_MAPback to summary
public static final String VIEW_MAP

Stores the view map.

VIEW_MAP_IDback to summary
public static final String VIEW_MAP_ID

Stores the view map id.

VIEW_SCOPE_MANAGERback to summary
public static final String VIEW_SCOPE_MANAGER

Stores the constant to keep track of the ViewScopeManager.

Constructor Detail

ViewScopeManagerback to summary
public ViewScopeManager()

Constructor.

Method Detail

clearback to summary
public void clear(FacesContext facesContext)

Clear the current view map using the Faces context.

Parameters
facesContext:FacesContext

the Faces context.

clearback to summary
public void clear(FacesContext facesContext, Map<String, Object> viewMap)

Deprecated

Clear the given view map. Use the version with viewMapId.

Parameters
facesContext:FacesContext

the Faces context.

viewMap:Map<String, Object>

the view map.

Annotations
@Deprecated
clearback to summary
public void clear(FacesContext facesContext, String viewMapId, Map<String, Object> viewMap)

Clear the given view map.

Parameters
facesContext:FacesContext

the Faces context.

viewMapId:String

The ID of the view map

viewMap:Map<String, Object>

the view map.

destroyBeansback to summary
public void destroyBeans(FacesContext facesContext, Map<String, Object> viewMap)

Destroy the managed beans from the given view map.

Parameters
facesContext:FacesContext

the Faces Context.

viewMap:Map<String, Object>

the view map.

destroyBeansback to summary
private void destroyBeans(ApplicationAssociate applicationAssociate, Map<String, Object> viewMap)

Destroy the managed beans from the given view map.

Parameters
applicationAssociate:ApplicationAssociate

the application associate.

viewMap:Map<String, Object>

the view map.

getContextManagerback to summary
pack-priv ViewScopeContextManager getContextManager()

Get the CDI context manager.

Returns:ViewScopeContextManager

the CDI context manager.

getInstanceback to summary
public static ViewScopeManager getInstance(FacesContext facesContext)

Get our instance.

Parameters
facesContext:FacesContext

the FacesContext.

Returns:ViewScopeManager

our instance.

isListenerForSourceback to summary
public boolean isListenerForSource(Object source)

Implements jakarta.faces.event.SystemEventListener.isListenerForSource.

Is a listener for the given source.

Parameters
source:Object

the source.

Returns:boolean

true if UIViewRoot, false otherwise.

Annotations
@Override
locateViewMapIdback to summary
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:FacesContext

The faces context

viewMap:Map<String, Object>

The view to locate

Returns:String

located ID

processEventback to summary
public void processEvent(SystemEvent systemEvent) throws AbortProcessingException

Implements jakarta.faces.event.SystemEventListener.processEvent.

Process the system event.

Parameters
systemEvent:SystemEvent

the system event.

Annotations
@Override
Exceptions
AbortProcessingException:
when processing needs to be aborted.
processPostConstructViewMapback to summary
private void processPostConstructViewMap(SystemEvent systemEvent)

Process the PostConstructViewMap system event.

Parameters
systemEvent:SystemEvent

the system event.

processPreDestroyViewMapback to summary
private void processPreDestroyViewMap(SystemEvent se)

Process the PreDestroyViewMap system event.

Parameters
se:SystemEvent

the system event.

removeEldestViewMapback to summary
private void removeEldestViewMap(FacesContext facesContext, String viewMapId, Map<String, Object> eldestViewMap)

Remove the eldest view map from the active view maps.

Parameters
facesContext:FacesContext

the context

viewMapId:String

the view map id

eldestViewMap:Map<String, Object>

the eldest view map.

sessionCreatedback to summary
public void sessionCreated(HttpSessionEvent se)

Overrides default jakarta.servlet.http.HttpSessionListener.sessionCreated.

Create the associated data in the session (if any).

Parameters
se:HttpSessionEvent

the HTTP session event.

Annotations
@Override
sessionDestroyedback to summary
public void sessionDestroyed(HttpSessionEvent httpSessionEvent)

Overrides default jakarta.servlet.http.HttpSessionListener.sessionDestroyed.

Destroy the associated data in the session.

Parameters
httpSessionEvent:HttpSessionEvent

the HTTP session event.

Annotations
@Override