Tapestry 5
  1. Tapestry 5
  2. TAP5-1201

PageResponseRenderer.render() should call RequestGlobabls.storeActivePageName(String pageName)

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.2.0
    • Fix Version/s: 5.2.1
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      Applications may want render an error page as a response to handling an exception thrown from a page. This can be achieved by calling PageResponseRenderer.render() and worked in T5.1.05 but in T5.2 throws ComponentSource.getActivePage() throws "org.apache.tapestry5.ioc.internal.util.TapestryException: The identity of the active page for this request has not yet been established" if the newly added RequestGlobabls.storeActivePageName(String pageName) hasn't been called before. When asked on the mailing list (http://www.listware.net/201007/tapestry-users/10342-using-pageresponserendererrender-in-t52.html) for adding the call to PageResponseRenderer.render(), Howard's response was:
      "I suppose it could; just a case of unexpected use of the APIs. As currently coded, we assume that the active page is identified by the component event or page render dispatcher."

      1. TAP5-1201.patch
        2 kB
        Kalle Korhonen

        Activity

        Hide
        Kalle Korhonen added a comment -

        Apply patch to the root of tapestry-core. There's no unit test for now as I was unsure which one of these would be the best option:
        1) Add a unit test to ComponentSourceImplTest
        2) Create a new unit test class PageResponseRendererImplTest and implement a unit test similar to ComponentSourceImplTest.get_active_page()
        3) A functional test, where?
        4) This functionality shouldn't be added in, instead you should do X

        It's an easy addition and I really would like to resolve this one way or another. If you think this is incorrect, I don't mind as long as you point me towards a proper solution.

        Show
        Kalle Korhonen added a comment - Apply patch to the root of tapestry-core. There's no unit test for now as I was unsure which one of these would be the best option: 1) Add a unit test to ComponentSourceImplTest 2) Create a new unit test class PageResponseRendererImplTest and implement a unit test similar to ComponentSourceImplTest.get_active_page() 3) A functional test, where? 4) This functionality shouldn't be added in, instead you should do X It's an easy addition and I really would like to resolve this one way or another. If you think this is incorrect, I don't mind as long as you point me towards a proper solution.
        Hide
        Christophe Cordenier added a comment - - edited

        Active page name is used to pre-allocates control names in Form component, but also to append loopback marker in link generated by LinkSource.

        Two decent workarounds :

        • Redirect instead of direct rendering
        • Insert your security component request filter after the one that initializes active page ("InitializeActivePageName")

        At last, the active page state should be reseted in case of exception (can be done in developer code with onException) and current active page should be changed in DefaultRequestExceptionHandler to avoid consistency problem in loopback URL.

        Show
        Christophe Cordenier added a comment - - edited Active page name is used to pre-allocates control names in Form component, but also to append loopback marker in link generated by LinkSource. Two decent workarounds : Redirect instead of direct rendering Insert your security component request filter after the one that initializes active page ("InitializeActivePageName") At last, the active page state should be reseted in case of exception (can be done in developer code with onException) and current active page should be changed in DefaultRequestExceptionHandler to avoid consistency problem in loopback URL.
        Hide
        Hudson added a comment -

        Integrated in tapestry-5.2-freestyle #173 (See https://hudson.apache.org/hudson/job/tapestry-5.2-freestyle/173/)
        TAP5-1201: PageResponseRenderer.render() should call RequestGlobabls.storeActivePageName(String pageName)

        Show
        Hudson added a comment - Integrated in tapestry-5.2-freestyle #173 (See https://hudson.apache.org/hudson/job/tapestry-5.2-freestyle/173/ ) TAP5-1201 : PageResponseRenderer.render() should call RequestGlobabls.storeActivePageName(String pageName)

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Kalle Korhonen
          • Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development