com.liferay.faces.bridge.context.flash
Class BridgeFlashFactoryImpl
java.lang.Object
com.liferay.faces.bridge.context.flash.BridgeFlashFactory
com.liferay.faces.bridge.context.flash.BridgeFlashFactoryImpl
- All Implemented Interfaces:
- FactoryWrapper<BridgeFlashFactory>, javax.faces.FacesWrapper<BridgeFlashFactory>
public class BridgeFlashFactoryImpl
- extends BridgeFlashFactory
This class provides a factory-style way of obtaining the JSF Flash scope instance provided by the JSF
runtime (Mojarra or MyFaces).
Background: The JSF 2.0/2.1 API does not currently provide a factory-style way of obtaining Flash scope
instances. Instead, the ExternalContext.getFlash() method inside the JSF runtime is responsible for acting as
a pseudo-factory for creating instances. If the bridge were to use that approach for obtaining the Flash
scope instance, it would require the bridge to create instances of the JSF runtime's ExternalContext. Such an
operation would impose a big cost/overhead/expense, and since there are Servlet-API dependencies involved, it would
require the bridge to provide hack implementations of the ServletContext, HttpServletRequest, and HttpServletResponse. All this would be
required, simply to call the ExternalContext.getFlash() method.
As an alternative approach, this class simply uses Java reflection to obtain the JSF Flash scope instance
from the ClassLoader. While it is true that Java reflection is expensive, it is certainly less expensive than
the ExternalContext.getFlash() approach described above. Hopefully we can get a factory-style way of
obtaining Flash scope instances in the JSF 2.2 API, which would make this class obsolete.
- Author:
- Neil Griffin
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BridgeFlashFactoryImpl
public BridgeFlashFactoryImpl()
getBridgeFlash
public BridgeFlash getBridgeFlash()
- Specified by:
getBridgeFlash in class BridgeFlashFactory
getWrapped
public BridgeFlashFactory getWrapped()
Copyright © 2014 Liferay, Inc.. All Rights Reserved.