You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Stanton <pa...@mapshed.com.au> on 2010/05/19 09:15:42 UTC
using a landing page to direct to other pages
in tapestry 4.1 it was possible to throw a PageRedirectException in the
pageBeginRender method.
This was useful in that you could check pre-requisites before actually
rendering the page and optionally render an alternative page (without
going to the client for a redirect).
What is the tidiest alternative in tapestry 5.1?
thanks, p.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: using a landing page to direct to other pages
Posted by Paul Stanton <pa...@mapshed.com.au>.
Thanks Markus,
That is certainly better than what I had and yes I would prefer to
handle this in a single request without forwarding/redirecting the browser.
Do you know if there is any way to actually instantiate a page class
within 'handlePageRender' and then return this page object to be
rendered? that would be optimum as right now the coupling between the
parameters array and the page object is a bit loose for my liking. I
would prefer to be able to prepare the object from within this method.
thanks again, p.
Markus Feindler wrote:
> Well, I think this is what he's trying to avoid: a client redirect (http
> redirect). He wants to delegate the request to a different page using the
> same request/response cycle.
>
> You would rather use a ComponentRequestFilter for that: Change the
> PageRenderRequestParameters and send them to the next handler.
>
> A simple extract:
>
> public void handlePageRender(PageRenderRequestParameters parameters,
> ComponentRequestHandler handler) throws IOException {
> // YOUR LOGIC HERE
> URLEventContext ctx = new URLEventContext(encoder, new
> String[] { "failure" });
> // PageRenderRequestParameters params = new
> PageRenderRequestParameters("Index", new EmptyEventContext());
> PageRenderRequestParameters params = new
> PageRenderRequestParameters("Index", ctx);
> handler.handlePageRender(params);
> }
> }
>
>
>>
>> -------- Original-Nachricht --------
>> Datum: Wed, 19 May 2010 11:01:05 +0200
>> Von: Dragan Sahpaski <dr...@gmail.com>
>> An: Tapestry users <us...@tapestry.apache.org>
>> Betreff: Re: using a landing page to direct to other pages
>>
>> I use
>> org.apache.tapestry5.services.Response.sendRedirect(String URL)
>> or
>> org.apache.tapestry5.services.Response.sendRedirect(Link link)
>> you can create a PageLink like with
>> PageRenderLinkSource.createPageRenderLink
>>
>>
>> see
>>
>>
>> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/Response.html#sendRedirect(java.lang.String)
>>
>> <http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/Response.html#sendRedirect(java.lang.String)>
>>
>> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/Response.html#sendRedirect(org.apache.tapestry5.Link)
>>
>> <http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/Response.html#sendRedirect(org.apache.tapestry5.Link)>
>>
>> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/PageRenderLinkSource.html
>>
>>
>> <http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/PageRenderLinkSource.html>
>> Bye
>>
>> On Wed, May 19, 2010 at 9:15 AM, Paul Stanton <pa...@mapshed.com.au>
>> wrote:
>>
>>
>>> in tapestry 4.1 it was possible to throw a PageRedirectException in the
>>> pageBeginRender method.
>>>
>>> This was useful in that you could check pre-requisites before actually
>>> rendering the page and optionally render an alternative page (without
>>>
>> going
>>
>>> to the client for a redirect).
>>>
>>> What is the tidiest alternative in tapestry 5.1?
>>>
>>> thanks, p.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>
>
Re: using a landing page to direct to other pages
Posted by Markus Feindler <Ma...@gmx.de>.
Well, I think this is what he's trying to avoid: a client redirect (http
redirect). He wants to delegate the request to a different page using the
same request/response cycle.
You would rather use a ComponentRequestFilter for that: Change the
PageRenderRequestParameters and send them to the next handler.
A simple extract:
public void handlePageRender(PageRenderRequestParameters parameters,
ComponentRequestHandler handler) throws IOException {
// YOUR LOGIC HERE
URLEventContext ctx = new URLEventContext(encoder, new
String[] { "failure" });
// PageRenderRequestParameters params = new
PageRenderRequestParameters("Index", new EmptyEventContext());
PageRenderRequestParameters params = new
PageRenderRequestParameters("Index", ctx);
handler.handlePageRender(params);
}
}
>
> -------- Original-Nachricht --------
> Datum: Wed, 19 May 2010 11:01:05 +0200
> Von: Dragan Sahpaski <dr...@gmail.com>
> An: Tapestry users <us...@tapestry.apache.org>
> Betreff: Re: using a landing page to direct to other pages
>
> I use
> org.apache.tapestry5.services.Response.sendRedirect(String URL)
> or
> org.apache.tapestry5.services.Response.sendRedirect(Link link)
> you can create a PageLink like with
> PageRenderLinkSource.createPageRenderLink
>
>
> see
>
>
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/Response.html#sendRedirect(java.lang.String)
>
> <http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/Response.html#sendRedirect(java.lang.String)>
>
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/Response.html#sendRedirect(org.apache.tapestry5.Link)
>
> <http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/Response.html#sendRedirect(org.apache.tapestry5.Link)>
>
> http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/PageRenderLinkSource.html
>
>
> <http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/PageRenderLinkSource.html>
> Bye
>
> On Wed, May 19, 2010 at 9:15 AM, Paul Stanton <pa...@mapshed.com.au>
> wrote:
>
> > in tapestry 4.1 it was possible to throw a PageRedirectException in the
> > pageBeginRender method.
> >
> > This was useful in that you could check pre-requisites before actually
> > rendering the page and optionally render an alternative page (without
> going
> > to the client for a redirect).
> >
> > What is the tidiest alternative in tapestry 5.1?
> >
> > thanks, p.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
Re: using a landing page to direct to other pages
Posted by Dragan Sahpaski <dr...@gmail.com>.
I use org.apache.tapestry5.services.Response.sendRedirect(String URL)
or
org.apache.tapestry5.services.Response.sendRedirect(Link link)
you can create a PageLink like with
PageRenderLinkSource.createPageRenderLink
see
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/Response.html#sendRedirect(java.lang.String)
<http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/Response.html#sendRedirect(java.lang.String)>
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/Response.html#sendRedirect(org.apache.tapestry5.Link)
<http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/Response.html#sendRedirect(org.apache.tapestry5.Link)>
http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/PageRenderLinkSource.html
<http://tapestry.apache.org/tapestry5/apidocs/org/apache/tapestry5/services/PageRenderLinkSource.html>
Bye
On Wed, May 19, 2010 at 9:15 AM, Paul Stanton <pa...@mapshed.com.au> wrote:
> in tapestry 4.1 it was possible to throw a PageRedirectException in the
> pageBeginRender method.
>
> This was useful in that you could check pre-requisites before actually
> rendering the page and optionally render an alternative page (without going
> to the client for a redirect).
>
> What is the tidiest alternative in tapestry 5.1?
>
> thanks, p.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>