You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2016/04/26 06:08:13 UTC

[jira] [Commented] (MYFACES-4039) Even after renderResponse set in the beforePhase of the InvokeApplication PhaseListener - events are still broadcasted

    [ https://issues.apache.org/jira/browse/MYFACES-4039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15257533#comment-15257533 ] 

Leonardo Uribe commented on MYFACES-4039:
-----------------------------------------

Should renderResponse(...) skip further processing?

No. JSF spec section 3.4.2.6 says this about renderResponse :

"... During event broadcasting, a listener processing an event may ...

Call renderResponse() on the FacesContext instance for the current request. This tells the JSF implementation that, when the current phase of the request processing lifecycle has been completed, control should be transferred to the Render Response phase. ..."

MyFaces is doing this step just as the JSF spec says. Even if Mojarra behaves as you described, the spec wording is clear. This is a bug in Mojarra and should be reported to its issue tracker instead. I'll close this issue as invalid. Thanks for report it to MyFaces. 

> Even after renderResponse set in the beforePhase of the InvokeApplication PhaseListener - events are still broadcasted
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-4039
>                 URL: https://issues.apache.org/jira/browse/MYFACES-4039
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-344
>    Affects Versions: 2.2.9
>         Environment: JDK 7, Websphere Liberty Profile JEE7 - 8.5.5.8
>            Reporter: Vijay Pandey
>
> We have a phaseListener that is setup against InvokeApplication phase - so when there is a exception in beforePhase, we set the renderResponse on facesContext, thinking that it will skip further processing and will not broadcast the events on InvokeApplication, but it does.
> Class: LifecycleImpl - line # 191 onwards --
> {code:title=LifecycleImpl.java|borderStyle=solid}
> if (shouldRenderResponse(context, currentPhaseId, true))
>             {
>                 skipFurtherProcessing = true;
>             }
>             if (executor.execute(context))
>             {
>                 return true;
>             }
> {code}
> Now the above code  clearly doesn't skip the executor.execute(context) even when renderResponse was executed. 
> But Mojarra 2.2.11 - behaves differently - it will skip if renderResponse is called in beforePhase.
> com.sun.faces.lifecycle.Phase - line # 99 onwards:
> {code:title=Phase.java|borderStyle=solid}
> handleBeforePhase(context, listeners, event);
>             if (!shouldSkip(context)) {
>                 execute(context);
>             }
> {code}
> "shouldSkip" method impl in Phase.java
> {code:title=Phase.java|borderStyle=solid}
>   private boolean shouldSkip(FacesContext context) {
>         if (context.getResponseComplete()) {
>             return (true);
>         } else if (context.getRenderResponse() &&
>                    !PhaseId.RENDER_RESPONSE.equals(this.getId())) {
>             return (true);
>         } else {
>             return (false);
>         }
>     }
> {code}
> Now is Mojarra wrong or Myfaces implementation wrong? In cases like this what should be the mechanism to skip the events if render response is set on the before phase.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)