[
https://issues.apache.org/jira/browse/MYFACES-3358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13146753#comment-13146753
]
Keith Wong commented on MYFACES-3358:
-------------------------------------
I do agree that it is not clear in the spec that how the lifecycle of a flash
would be. But I think this case should work in the mojarra implementation.
After investigation, I found that the following changes in
org.apache.myfaces.lifecycle.LifecycleImpl could handle the flash in this case:
@Override
public void render(FacesContext facesContext) throws FacesException
{
//try
//{
// if the response is complete we should not be invoking the phase
listeners
if (isResponseComplete(facesContext, renderExecutor.getPhase(),
true))
{
facesContext.setCurrentPhaseId(renderExecutor.getPhase());
Flash flash = facesContext.getExternalContext().getFlash();
flash.doPrePhaseActions(facesContext);
flash.doPostPhaseActions(facesContext);
return;
}
...
> Flash created in ExceptionHandler not work
> ------------------------------------------
>
> Key: MYFACES-3358
> URL: https://issues.apache.org/jira/browse/MYFACES-3358
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-314
> Affects Versions: 2.1.3
> Environment: WebSphere 8.0
> Reporter: Keith Wong
> Assignee: Leonardo Uribe
>
> I have a custom ExceptionHandler for handling ViewExpiredException as
> occurred in session timeout or application restart. I have to tell the user
> in the redirected page the reason for being redirected. Here is the handler:
> public void handle() throws FacesException {
> for (Iterator<ExceptionQueuedEvent>
> i=getUnhandledExceptionQueuedEvents().iterator(); i.hasNext(); ) {
> ExceptionQueuedEventContext context =
> i.next().getContext();
> Throwable t = context.getException();
> if (t instanceof ViewExpiredException) {
> FacesContext ctx =
> FacesContext.getCurrentInstance();
> ViewExpiredException vee =
> (ViewExpiredException)t;
> try {
> ctx.addMessage(null, new
> FacesMessage(FacesMessage.SEVERITY_ERROR, vee.getClass().getName(),
> vee.getMessage()));
> Flash flash =
> ctx.getExternalContext().getFlash();
> flash.put("expiredViewId",
> vee.getViewId());
> flash.setKeepMessages(true);
>
> ctx.getApplication().getNavigationHandler().handleNavigation(ctx, null,
> "/login?faces-redirect=true");
> ctx.renderResponse();
> }
> finally {
> i.remove();
> }
> }
> }
> super.handle();
> }
> In the login.xhtml, it has #{flash.expiredViewId} and <f:messages> but both
> are empty when displayed.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira