FacesContext facesContext =
(FacesContext) elContext.getContext(FacesContext.class);
ExternalContext extCtx = facesContext.getExternalContext();
// try to get the flash from the session.
FlashFactory ff = (FlashFactory)
FactoryFinder.getFactory(FactoryFinder.FLASH_FACTORY);
Map<String, Object> flash = ff.getFlash(false);
elContext.setPropertyResolved(true);
if (null == flash)
{
// create a new one and store it in the session.
flash = ff.getFlash(true);
extCtx.getSessionMap().put(ELFlash.FLASH_ATTRIBUTE_NAME, flash);
}
result = flash;
}
}
// If the base argument is the flash itself...
else if (base instanceof Flash)
{
FacesContext facesContext =
(FacesContext) elContext.getContext(FacesContext.class);
ExternalContext extCtx = facesContext.getExternalContext();
// try to get the flash from the session.
FlashFactory ff = (FlashFactory)
FactoryFinder.getFactory(FactoryFinder.FLASH_FACTORY);
Map<String, Object> flash = ff.getFlash(false);
if (base == flash)
{
// and the property argument is "keep"...
if (property.toString().equals(FLASH_KEEP_VARIABLE_NAME))
{
elContext.setPropertyResolved(true);
// then this is a request to promote the value
// "property", which is assumed to have been previously
// stored in request scope via the "flash.now"
// expression, to flash scope.
result = base;
// Set a flag so the flash itself can look in the request
// and promote the value to the next request
ff.getFlash(true);
ELFlash.setKeepFlag(facesContext);
}
// Otherwise, if base is the flash, and property is "now"...
else if (property.toString().equals(FLASH_NOW_VARIABLE_NAME))
{