You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Russell Brown <Ru...@ioko.com> on 2008/05/30 10:23:43 UTC

Redirects

Hi All,

New to Tapestry 5. I have read the Building Web Apps Tapestry 5 book by
Alexander Kolesnikov and am working through the documentation and Wiki
too and I have a functional little web app at the moment that took me
all of a few hours to build and test so I am very pleased with the
productivity.

 

I haven't found how to redirect to an external url though. I think my
mind is stuck in Strruts MVC groove after all these years. So I have a
Page class and what I want the page to do is check for the presence of
an @ApplicationState property and redirect to an external url. In struts
I'd have the logic in the execute method of an Action. In Tapestry 5 do
I put this code in the onBeforeRender method? And how exactly do I do a
redirect to an external url please?

 

I know I am thinking in the action-forward-to-view way and that the
relationship between a page class and a page template is not exactly
analogous...I think this is conceptually where I am stuck. Not all web
apps are about pages so what metaphor is there for requests that aren't
page based? My practical problem above stems from current failure to
grok the pattern Tapestry 5 implements. 

 

Many thanks in advance if you can help (with either my practical or
conceptual problem).

 

Russell



Communications on or through ioko's computer systems may be monitored or recorded to secure effective system operation and for other lawful purposes.

Unless otherwise agreed expressly in writing, this communication is to be treated as confidential and the information in it may not be used or disclosed except for the purpose for which it has been sent. If you have reason to believe that you are not the intended recipient of this communication, please contact the sender immediately. No employee is authorised to conclude any binding agreement on behalf of ioko with another party by e-mail without prior express written confirmation.

ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights reserved.

RE: Redirects

Posted by Russell Brown <Ru...@ioko.com>.
Thanks Bill.

-----Original Message-----
From: Bill Holloway [mailto:bill.holloway@gmail.com] 
Sent: 30 May 2008 10:23
To: Tapestry users
Subject: Re: Redirects

Hi Russell,

I do this in the SetupRender phase.

@Inject
private org.apache.tapestry.services.Response _response;

void setupRender () throws Exception
    {
        if (/* condition satisfied */)
            _response.sendRedirect( "http://example.com" );
    }

Cheers,
Bill

On Fri, May 30, 2008 at 3:23 AM, Russell Brown <Ru...@ioko.com>
wrote:

> Hi All,
>
> New to Tapestry 5. I have read the Building Web Apps Tapestry 5 book
by
> Alexander Kolesnikov and am working through the documentation and Wiki
> too and I have a functional little web app at the moment that took me
> all of a few hours to build and test so I am very pleased with the
> productivity.
>
>
>
> I haven't found how to redirect to an external url though. I think my
> mind is stuck in Strruts MVC groove after all these years. So I have a
> Page class and what I want the page to do is check for the presence of
> an @ApplicationState property and redirect to an external url. In
struts
> I'd have the logic in the execute method of an Action. In Tapestry 5
do
> I put this code in the onBeforeRender method? And how exactly do I do
a
> redirect to an external url please?
>
>
>
> I know I am thinking in the action-forward-to-view way and that the
> relationship between a page class and a page template is not exactly
> analogous...I think this is conceptually where I am stuck. Not all web
> apps are about pages so what metaphor is there for requests that
aren't
> page based? My practical problem above stems from current failure to
> grok the pattern Tapestry 5 implements.
>
>
>
> Many thanks in advance if you can help (with either my practical or
> conceptual problem).
>
>
>
> Russell
>
>
>
> Communications on or through ioko's computer systems may be monitored
or
> recorded to secure effective system operation and for other lawful
purposes.
>
> Unless otherwise agreed expressly in writing, this communication is to
be
> treated as confidential and the information in it may not be used or
> disclosed except for the purpose for which it has been sent. If you
have
> reason to believe that you are not the intended recipient of this
> communication, please contact the sender immediately. No employee is
> authorised to conclude any binding agreement on behalf of ioko with
another
> party by e-mail without prior express written confirmation.
>
> ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights
reserved.
>



-- 
Those who can make you believe absurdities can make you commit
atrocities.

Voltaire


Communications on or through ioko's computer systems may be monitored or recorded to secure effective system operation and for other lawful purposes.

Unless otherwise agreed expressly in writing, this communication is to be treated as confidential and the information in it may not be used or disclosed except for the purpose for which it has been sent. If you have reason to believe that you are not the intended recipient of this communication, please contact the sender immediately. No employee is authorised to conclude any binding agreement on behalf of ioko with another party by e-mail without prior express written confirmation.

ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights reserved.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Redirects

Posted by Bill Holloway <bi...@gmail.com>.
I'm not sure you can do that from a lifecycle method, although you can
return Components.

bill

On Fri, May 30, 2008 at 6:13 AM, Christian Gorbach <ch...@gmx.at>
wrote:

> or more elegant::
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
> just return an java.net.URL object
> c)hristian
>
>
>  Hi Russell,
>>
>> I do this in the SetupRender phase.
>>
>> @Inject
>> private org.apache.tapestry.services.Response _response;
>>
>> void setupRender () throws Exception
>>    {
>>        if (/* condition satisfied */)
>>            _response.sendRedirect( "http://example.com" );
>>    }
>>
>> Cheers,
>> Bill
>>
>> On Fri, May 30, 2008 at 3:23 AM, Russell Brown <Ru...@ioko.com>
>> wrote:
>>
>>
>>
>>> Hi All,
>>>
>>> New to Tapestry 5. I have read the Building Web Apps Tapestry 5 book by
>>> Alexander Kolesnikov and am working through the documentation and Wiki
>>> too and I have a functional little web app at the moment that took me
>>> all of a few hours to build and test so I am very pleased with the
>>> productivity.
>>>
>>>
>>>
>>> I haven't found how to redirect to an external url though. I think my
>>> mind is stuck in Strruts MVC groove after all these years. So I have a
>>> Page class and what I want the page to do is check for the presence of
>>> an @ApplicationState property and redirect to an external url. In struts
>>> I'd have the logic in the execute method of an Action. In Tapestry 5 do
>>> I put this code in the onBeforeRender method? And how exactly do I do a
>>> redirect to an external url please?
>>>
>>>
>>>
>>> I know I am thinking in the action-forward-to-view way and that the
>>> relationship between a page class and a page template is not exactly
>>> analogous...I think this is conceptually where I am stuck. Not all web
>>> apps are about pages so what metaphor is there for requests that aren't
>>> page based? My practical problem above stems from current failure to
>>> grok the pattern Tapestry 5 implements.
>>>
>>>
>>>
>>> Many thanks in advance if you can help (with either my practical or
>>> conceptual problem).
>>>
>>>
>>>
>>> Russell
>>>
>>>
>>>
>>> Communications on or through ioko's computer systems may be monitored or
>>> recorded to secure effective system operation and for other lawful
>>> purposes.
>>>
>>> Unless otherwise agreed expressly in writing, this communication is to be
>>> treated as confidential and the information in it may not be used or
>>> disclosed except for the purpose for which it has been sent. If you have
>>> reason to believe that you are not the intended recipient of this
>>> communication, please contact the sender immediately. No employee is
>>> authorised to conclude any binding agreement on behalf of ioko with
>>> another
>>> party by e-mail without prior express written confirmation.
>>>
>>> ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights reserved.
>>>
>>>
>>>
>>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Those who can make you believe absurdities can make you commit atrocities.

Voltaire

Re: Redirects

Posted by Christian Gorbach <ch...@gmx.at>.
or more elegant::
http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html
just return an java.net.URL object
c)hristian

> Hi Russell,
>
> I do this in the SetupRender phase.
>
> @Inject
> private org.apache.tapestry.services.Response _response;
>
> void setupRender () throws Exception
>     {
>         if (/* condition satisfied */)
>             _response.sendRedirect( "http://example.com" );
>     }
>
> Cheers,
> Bill
>
> On Fri, May 30, 2008 at 3:23 AM, Russell Brown <Ru...@ioko.com>
> wrote:
>
>   
>> Hi All,
>>
>> New to Tapestry 5. I have read the Building Web Apps Tapestry 5 book by
>> Alexander Kolesnikov and am working through the documentation and Wiki
>> too and I have a functional little web app at the moment that took me
>> all of a few hours to build and test so I am very pleased with the
>> productivity.
>>
>>
>>
>> I haven't found how to redirect to an external url though. I think my
>> mind is stuck in Strruts MVC groove after all these years. So I have a
>> Page class and what I want the page to do is check for the presence of
>> an @ApplicationState property and redirect to an external url. In struts
>> I'd have the logic in the execute method of an Action. In Tapestry 5 do
>> I put this code in the onBeforeRender method? And how exactly do I do a
>> redirect to an external url please?
>>
>>
>>
>> I know I am thinking in the action-forward-to-view way and that the
>> relationship between a page class and a page template is not exactly
>> analogous...I think this is conceptually where I am stuck. Not all web
>> apps are about pages so what metaphor is there for requests that aren't
>> page based? My practical problem above stems from current failure to
>> grok the pattern Tapestry 5 implements.
>>
>>
>>
>> Many thanks in advance if you can help (with either my practical or
>> conceptual problem).
>>
>>
>>
>> Russell
>>
>>
>>
>> Communications on or through ioko's computer systems may be monitored or
>> recorded to secure effective system operation and for other lawful purposes.
>>
>> Unless otherwise agreed expressly in writing, this communication is to be
>> treated as confidential and the information in it may not be used or
>> disclosed except for the purpose for which it has been sent. If you have
>> reason to believe that you are not the intended recipient of this
>> communication, please contact the sender immediately. No employee is
>> authorised to conclude any binding agreement on behalf of ioko with another
>> party by e-mail without prior express written confirmation.
>>
>> ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights reserved.
>>
>>     
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Redirects

Posted by Bill Holloway <bi...@gmail.com>.
Hi Russell,

I do this in the SetupRender phase.

@Inject
private org.apache.tapestry.services.Response _response;

void setupRender () throws Exception
    {
        if (/* condition satisfied */)
            _response.sendRedirect( "http://example.com" );
    }

Cheers,
Bill

On Fri, May 30, 2008 at 3:23 AM, Russell Brown <Ru...@ioko.com>
wrote:

> Hi All,
>
> New to Tapestry 5. I have read the Building Web Apps Tapestry 5 book by
> Alexander Kolesnikov and am working through the documentation and Wiki
> too and I have a functional little web app at the moment that took me
> all of a few hours to build and test so I am very pleased with the
> productivity.
>
>
>
> I haven't found how to redirect to an external url though. I think my
> mind is stuck in Strruts MVC groove after all these years. So I have a
> Page class and what I want the page to do is check for the presence of
> an @ApplicationState property and redirect to an external url. In struts
> I'd have the logic in the execute method of an Action. In Tapestry 5 do
> I put this code in the onBeforeRender method? And how exactly do I do a
> redirect to an external url please?
>
>
>
> I know I am thinking in the action-forward-to-view way and that the
> relationship between a page class and a page template is not exactly
> analogous...I think this is conceptually where I am stuck. Not all web
> apps are about pages so what metaphor is there for requests that aren't
> page based? My practical problem above stems from current failure to
> grok the pattern Tapestry 5 implements.
>
>
>
> Many thanks in advance if you can help (with either my practical or
> conceptual problem).
>
>
>
> Russell
>
>
>
> Communications on or through ioko's computer systems may be monitored or
> recorded to secure effective system operation and for other lawful purposes.
>
> Unless otherwise agreed expressly in writing, this communication is to be
> treated as confidential and the information in it may not be used or
> disclosed except for the purpose for which it has been sent. If you have
> reason to believe that you are not the intended recipient of this
> communication, please contact the sender immediately. No employee is
> authorised to conclude any binding agreement on behalf of ioko with another
> party by e-mail without prior express written confirmation.
>
> ioko365 Ltd.  VAT reg 656 2443 31. Reg no 3048367. All rights reserved.
>



-- 
Those who can make you believe absurdities can make you commit atrocities.

Voltaire