You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Marcel Sammut <su...@rogers.com> on 2009/12/17 06:50:04 UTC
T5 Page Engine
Greetings,
I'm trying to create an "engine" in tapestry which is capable of determining
which page to display and can also provide parameters. I currently have a
tapestry 3 application which does this via the old
tapestry.engine.AbstractService.
What I've come across so far is using a Dispatcher which is contributed
before the PageRenderDispatcher that resolves the page name to be displayed
with the parameter values needed. My web pages will contain links ("<\a
href...") that points to a given url which matches the Dispatchers name. Of
course, the dispatcher checks the page name and if matches processes and
determines the page name, otherwise normal dispatching occurs.
My problem is when the dispatcher is dispatching a request, how can I
"redirect" to a page and inject objects needed by the page?
My page html:
<\a href="/mywebapp/mydispatcher?someparameter='somevalue'">My Link<\/a>
Java - Tapestry Dispatcher
Public class MyDispatcher implements Dispatcher
private ComponentSource componentSource;
Public MyDispatcher(ComponentSource componentSource) {
this.componentSource = componentSource;
}
@Override
public boolean dispatch(Request request, Response response) throws
IOException {
String path = request.getPath();
if ("mydispatcher" == path) {
String pageName =
functionThatWillGetPageNameFromRequestParameters(request, response);
Component page =
componentSource.getPage(pageName);
/****** Want to inject objects/parameters
******* And render/display this "page"
component [cycle.activate(page) in T3]
}
return true;
}
}
I'm not sure if this is the correct approach and am trying to port some T3
applications over to T5.
Any ideas or thoughts on how to convert a T3 AbstractService would be
useful.
Cheers,
Marcel
--
View this message in context: http://old.nabble.com/T5-Page-Engine-tp26823567p26823567.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
Re: T5 Page Engine
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Em Thu, 17 Dec 2009 03:50:04 -0200, Marcel Sammut <su...@rogers.com>
escreveu:
> Greetings,
Hello!
Why don't you use URL rewriting for that? Using it, there's no need to do
redirection, as it happens before the request processing.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, software architect and developer, Ars Machina Tecnologia da
Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org