Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-4039

Even after renderResponse set in the beforePhase of the InvokeApplication PhaseListener - events are still broadcasted

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 2.2.9
    • None
    • JSR-344
    • None
    • JDK 7, Websphere Liberty Profile JEE7 - 8.5.5.8

    Description

      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 –

      LifecycleImpl.java
      if (shouldRenderResponse(context, currentPhaseId, true))
                  {
                      skipFurtherProcessing = true;
                  }
      
                  if (executor.execute(context))
                  {
                      return true;
                  }
      

      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:

      Phase.java
      handleBeforePhase(context, listeners, event);
                  if (!shouldSkip(context)) {
                      execute(context);
                  }
      

      "shouldSkip" method impl in Phase.java

      Phase.java
        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);
              }
      
          }
      

      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.

      Attachments

        Activity

          People

            lu4242 Leonardo Uribe
            vijay.k.pandey@gmail.com Vijay Pandey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: