Vijay Pandey created MYFACES-4039:
-------------------------------------

             Summary: 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)

Reply via email to