You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Glen Stampoultzis <gs...@iinet.net.au> on 2003/11/14 00:06:25 UTC

Calculating a URL

I'm following Howards advise of throwing a RedirectException() to redirect 
the page.  If I want to redirect to a particular page I can easily put in a 
URL like this:

         "app?service=page/PersonalView"

but I was wondering if their was an cleaner way of calculating the correct 
URL from the page name.

Regards,


Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/


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


Re: Calculating a URL

Posted by Paul Ferraro <pm...@columbia.edu>.
Although you should know that PageRedirectException is a bit of a 
misnomer.  It doesn't actually perform a response redirect - it merely 
activates the specified page in the same request.

To answer your original question, to construct a tapestry URL 
programatically, use the getLink() method in the specific Service 
implementation.  For example:

To generate a URL using the PageService from within your page class, 
this should do the trick:

super.getService(Tapestry.PAGE_SERVICE).getLink(requestCycle, 
requestCycle.getPage(), new String[] { targetPage }).getURL();

The same can be done similarly for ExternalService and DirectService.

I'm not quite sure why there isn't a more accessible facility within 
Tapestry to generate true redirects - if there is one, it's not 
advertised very loudly.  I've had to write my own Engine method to do 
it.  Let me know if you'd like to hear more specifics.

Hope this helps,

Paul Ferraro


Glen Stampoultzis wrote:

> Ohh... missed those constructors taking a page. Doh!
>
> At 10:14 AM 14/11/2003, you wrote:
>
>> Check out PageRedirectException
>>
>> ----- Original Message -----
>> From: "Glen Stampoultzis" <gs...@iinet.net.au>
>> To: <ta...@jakarta.apache.org>
>> Sent: Friday, November 14, 2003 12:06 PM
>> Subject: Calculating a URL
>>
>>
>> >
>> > I'm following Howards advise of throwing a RedirectException() to 
>> redirect
>> > the page.  If I want to redirect to a particular page I can easily 
>> put in
>> a
>> > URL like this:
>> >
>> >          "app?service=page/PersonalView"
>> >
>> > but I was wondering if their was an cleaner way of calculating the 
>> correct
>> > URL from the page name.
>> >
>> > Regards,
>> >
>> >
>> > Glen Stampoultzis
>> > gstamp@iinet.net.au
>> > http://members.iinet.net.au/~gstamp/glen/
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>> >
>> >
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
> Glen Stampoultzis
> gstamp@iinet.net.au
> http://members.iinet.net.au/~gstamp/glen/
>



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


Re: Calculating a URL

Posted by Glen Stampoultzis <gs...@iinet.net.au>.
Ohh... missed those constructors taking a page. Doh!

At 10:14 AM 14/11/2003, you wrote:
>Check out PageRedirectException
>
>----- Original Message -----
>From: "Glen Stampoultzis" <gs...@iinet.net.au>
>To: <ta...@jakarta.apache.org>
>Sent: Friday, November 14, 2003 12:06 PM
>Subject: Calculating a URL
>
>
> >
> > I'm following Howards advise of throwing a RedirectException() to redirect
> > the page.  If I want to redirect to a particular page I can easily put in
>a
> > URL like this:
> >
> >          "app?service=page/PersonalView"
> >
> > but I was wondering if their was an cleaner way of calculating the correct
> > URL from the page name.
> >
> > Regards,
> >
> >
> > Glen Stampoultzis
> > gstamp@iinet.net.au
> > http://members.iinet.net.au/~gstamp/glen/
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/

Re: Calculating a URL

Posted by Richard Lewis-Shell <rl...@mac.com>.
Check out PageRedirectException

----- Original Message ----- 
From: "Glen Stampoultzis" <gs...@iinet.net.au>
To: <ta...@jakarta.apache.org>
Sent: Friday, November 14, 2003 12:06 PM
Subject: Calculating a URL


>
> I'm following Howards advise of throwing a RedirectException() to redirect
> the page.  If I want to redirect to a particular page I can easily put in
a
> URL like this:
>
>          "app?service=page/PersonalView"
>
> but I was wondering if their was an cleaner way of calculating the correct
> URL from the page name.
>
> Regards,
>
>
> Glen Stampoultzis
> gstamp@iinet.net.au
> http://members.iinet.net.au/~gstamp/glen/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>



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