I believe for page links, there is no difference. And you can just get
the LinkFactory.
For EventLinks, now it starts to get different because you are
targetting both a page and a component ( which can be on a different
page ). I'm still not a master on figuring this out, but I know what to
look out for:
pagelink:
http://server/page/pagecontext
eventlink:
http://server/pagewithcomponent:component/eventcontext?t:ac=pagecontext&t:cp=pagetorender
Andreas Pardeike wrote:
On 24 mar 2009, at 14.20, Robert Zeigler wrote:
I think that's ugly. :)
Consider:
componentSource
.getPage
(Index
.class).getComponentResources().createPageLink(Index.class,true);
Personally, I get suspicious of call chains nested more than about
two-deep... smells of tight coupling.
Ultimately, componentResources.createPageLink calls into LinkSource,
which calls into ComponentEvenLinkEncoder to create the link. *shrug*.
Why not bypass the nastiness and go straight to
ComponentEventLinkEncoder? It /is/ a public service, after all...
Personally, though, I wonder if it should be the other way around:
ComponentEventLinkEncoder really exposes too much of the internal
"guts" of how tapestry "thinks" about requests: page names, nested
component ids, etc. (In the form of the PageRequestParameters and
ComponentEventRequestParameters objects. In that regard, using
component resources is "correct" because it "hides" all of the gory
details...
Except that it still requires an ugly rats' nest of method calls.
Creating links to pages from within services seems like such a common
paradigm (redirecting to the login page on authentication failure, for
example); maybe we ought to have cleaner, public support for it...
I totally agree with Robert. Plus, what is the difference between:
componentSource.getPage(XXX.class).getComponentResources().createPageLink(XXX.class,true);
componentSource.getPage(YYY.class).getComponentResources().createPageLink(XXX.class,true);
Will I still get the same link? If so, why do I need to get a page in
first place?
/Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org