Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-674

Make it easy to implement a page callback mechanism

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 5.1.0.4
    • 5.2.0
    • tapestry-core
    • None

    Description

      In T4 there was a callback facility that allowed to returned to a page to which we had initially navigated to.

      Such facility is not present in T5 but it's possible to "not so easily as expected" implement it.
      My guess is that this kind of functionality is usually required when a user is redirected to a login page and after the user logs into the application we would like to it to return the page that it first accessed.

      I've implemented this using the PageRenderRequestFilter concept, where in the handle method i redirect to the login page and i store the original link in the session to be used by the login page to redirect to it.
      Here are the problems i encountered when implementing this functionality and that i think Tapestry should be able to easily solve them:

      • I would like to store a Link to the original page in the session. This solution won't work on clustered environments because Link isn't serializable. That could easily be changed.
      • I could store an java.net.URL which is serializable. So how do i build one ? The correct way i think would be to use PageRenderLinkSource to create a Link and then from it's absoluteURI create the URL. The problem is that PageRenderLinkSource.createPageRenderLinkWithContext gets the page context as an object array but you only have direct access to the original activation context in the form of an EventContext object that is given by the PageRenderRequestParameters parameter of the handle method. This could be easily solved by adding a PageRenderLinkSource.createPageRenderLinkWithContext whose context parameter could be of type EventContext.

      So, two easy changes could make implementing this kind of functionality trivial.

      Attachments

        Activity

          People

            hlship Howard Lewis Ship
            hpalma Hugo Palma
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: