com.liferay.faces.util.lifecycle
Class ViewScopePhaseListener
java.lang.Object
com.liferay.faces.util.lifecycle.ViewScopePhaseListener
- All Implemented Interfaces:
- Serializable, EventListener, javax.faces.event.PhaseListener
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
- Author:
- Neil Griffin
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ViewScopePhaseListener
public ViewScopePhaseListener()
afterPhase
public void afterPhase(javax.faces.event.PhaseEvent phaseEvent)
- Specified by:
afterPhase in interface javax.faces.event.PhaseListener
beforePhase
public void beforePhase(javax.faces.event.PhaseEvent phaseEvent)
- Specified by:
beforePhase in interface javax.faces.event.PhaseListener
injectManagedProperties
protected void injectManagedProperties(Object managedBean,
ViewScopePhaseListener.ManagedPropertyInjector managedPropertyInjector)
processViewScopedManagedBeans
protected void processViewScopedManagedBeans(javax.faces.context.FacesContext facesContext)
getManagedPropertyFields
protected Map<String,Field> getManagedPropertyFields(Class<?> managedBeanClass)
getManagedPropertyName
protected String getManagedPropertyName(javax.faces.bean.ManagedProperty managedProperty,
Field field)
getPhaseId
public javax.faces.event.PhaseId getPhaseId()
- Specified by:
getPhaseId in interface javax.faces.event.PhaseListener
Copyright © 2015 Liferay, Inc.. All rights reserved.