MyFaces Portlet Bridge
  1. MyFaces Portlet Bridge
  2. PORTLETBRIDGE-33

Redirect during action causes infinite loop if action/render run in same request

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0-alpha, 1.0.0-alpha-2, 1.0.0-beta, 2.0.0-alpha
    • Fix Version/s: 1.0.0-alpha-3
    • Component/s: Impl
    • Labels:
      None

      Description

      Redirect (of a Faces view) during an action is caught by the bridge and turned into a simple navigation – I.e. we view such a redirect as meaning change the view of the this portlet NOT change the view of the browser from the consumer page. Its impelmented by tacking a request attribute on in the redirect method and then detecting this attr in the lifecycle manager/controller (doFacesRequest). If a redirect is detected we return normally but don't preserve state. However the code doesn't remove the redirect request attribute. If the portlet container turns around and calls render in the same request scope the attr still exists. And as we upgraded the render impl to also detect/support such redirects, the carrying forward of this attribute causes the render to also think it now needs to do one of these navigational redirects – and the by product of executing this causes us to rerun the render with the same request attributes as the render started with – but oops this already contained the redirect attr carried forward from the action – so we get into an infinite loop.

      Solution is simple: merely remove the request attr before returning from the action.

      1. jira_33.patch
        0.7 kB
        Michael Freedman

        Activity

        Hide
        Michael Freedman added a comment -

        Applied attached patch file to fix the problem – I merely remove the redirect request attr before returning from the action. Fix has also been carried forward into the 2.0 codeline but not yet committed.

        Show
        Michael Freedman added a comment - Applied attached patch file to fix the problem – I merely remove the redirect request attr before returning from the action. Fix has also been carried forward into the 2.0 codeline but not yet committed.
        Hide
        Michael Freedman added a comment -

        Fixes PortletBridge-33 by removing redirect attr before returning from action. This patch is for the 1.0 codeline. A similar fix has been made ready for 2.0 but is not yet committed/available.

        Show
        Michael Freedman added a comment - Fixes PortletBridge-33 by removing redirect attr before returning from action. This patch is for the 1.0 codeline. A similar fix has been made ready for 2.0 but is not yet committed/available.

          People

          • Assignee:
            Michael Freedman
            Reporter:
            Michael Freedman
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development