Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-461

WeldPhaseListener should only cleanup response once

    XMLWordPrintable

Details

    Description

      FacesContext#getResponseCompete() may be true on more than one invocation of WeldPhaseListener#afterPhase(). Since the phase listener does not check to see if the request has already been cleaned up, Weld fails on the second cleanup attempt.

      How does this scenario happen? One case is when the application calls ExternalContext#dispatch() to forward to another view. When the dispatch happens, the current lifecycle is marked FacesContext#responseComplete(). Control turns over to the lifecycle of the dispatched request. When the response is complete in that request, the WeldPhaseListener#afterPhase() will be called with FacesContext#getResponseComplete() equal to true. Control returns to the original request lifecycle, WeldPhaseListener#afterPhase() will again be called with FacesContext#getResponseComplete() equal to true.

      The WeldPhaseListener should check to see if cleanup has already occurred, skipping cleanup if it has.

      Applications should not expect contexts to be active in the original request lifecycle after ExternalContext#dispatch() has been called.

      Attachments

        Activity

          People

            nickarls Nicklas Karlsson (Inactive)
            dan.j.allen Dan Allen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: