@ProviderType public class ViewScopePhaseListener extends Object implements javax.faces.event.PhaseListener
This class is a JSF PhaseListener that listens to the PhaseId.RESTORE_VIEW phase of the JSF
lifecycle. Its purpose is to re-inject ManagedProperty values into ViewScoped managed-bean instances
after postback.
When running under Mojarra, ViewScoped managed-beans are essentially stored in the underlying session.
When running under MyFaces, ViewScoped managed-beans are serialized after the JSF lifecycle runs, probably so
that they don't take up memory on the server. When doing a postback to a ViewScoped managed-bean, Mojarra
simply pulls the live instance from the session. But with MyFaces, the managed-bean must be deserialized. The problem
with this is that MyFaces does not re-inject @ManagedProperty values after deserialization. This class exists to
work-around this problem.
For more information, see: http://issues.liferay.com/browse/FACES-1400
| Constructor and Description |
|---|
ViewScopePhaseListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPhase(javax.faces.event.PhaseEvent phaseEvent) |
void |
beforePhase(javax.faces.event.PhaseEvent phaseEvent) |
protected Map<String,Field> |
getManagedPropertyFields(Class<?> managedBeanClass) |
protected String |
getManagedPropertyName(javax.faces.bean.ManagedProperty managedProperty,
Field field) |
javax.faces.event.PhaseId |
getPhaseId() |
protected void |
injectManagedProperties(Object managedBean,
com.liferay.faces.util.lifecycle.ViewScopePhaseListener.ManagedPropertyInjector managedPropertyInjector) |
protected void |
processViewScopedManagedBeans(javax.faces.context.FacesContext facesContext) |
public void afterPhase(javax.faces.event.PhaseEvent phaseEvent)
afterPhase in interface javax.faces.event.PhaseListenerpublic void beforePhase(javax.faces.event.PhaseEvent phaseEvent)
beforePhase in interface javax.faces.event.PhaseListenerpublic javax.faces.event.PhaseId getPhaseId()
getPhaseId in interface javax.faces.event.PhaseListenerprotected Map<String,Field> getManagedPropertyFields(Class<?> managedBeanClass)
protected String getManagedPropertyName(javax.faces.bean.ManagedProperty managedProperty, Field field)
protected void injectManagedProperties(Object managedBean, com.liferay.faces.util.lifecycle.ViewScopePhaseListener.ManagedPropertyInjector managedPropertyInjector)
protected void processViewScopedManagedBeans(javax.faces.context.FacesContext facesContext)
Copyright © 2020 Liferay, Inc.. All rights reserved.