Make it easy to implement a page callback mechanism
---------------------------------------------------
Key: TAP5-674
URL: https://issues.apache.org/jira/browse/TAP5-674
Project: Tapestry 5
Issue Type: Improvement
Components: tapestry-core
Affects Versions: 5.1.0.4
Reporter: Hugo Palma
Priority: Minor
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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.