You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Bill Lear <ra...@zopyra.com> on 2003/06/12 00:31:58 UTC

YAURL Question (sending a Tapestry URL via email, with args)

All this hURLing about URLs has made me chURLish.

Suppose I have a register page, as such:

    http://www.foo.com/biff/app?service=action/1/Login/1/register

Suppose the page has an email field, and the user fills this in and
hits submit.  I'd like to send them a confirmation email, to ensure
that they provide a valid email address before they are allowed to
become a confirmed user of the system.

In the email, I would like to send them a link that they can click on
(or cut-n-paste).  The target page of this link will be a confirmation
page, on which they will select a new password, hit enter, and be
confirmed.

So, how would I do this?  I'd like the URL to be as simple as
possible.  So, if I generate a unique confirmation token (tk) for the
user, I'd like to send them something like this, perhaps:

    http://www.foo.com/buzz/app?service=page/Confirm&tk=31NP5SL24XRS1GB7XU

or some such.

I know how to grab the tk part of the URL once in the Confirm page,
but how do I generate this URL in the first place, say from the
Request cycle object.  What I'd like is (surprise) something simple:

    Confirm confirm = (Confirm) cycle.getPage("Confirm");

    URL url = confirm.getURL(); // ??

    url.addParameter("tk", "31NP5SL24XRS1GB7XU");

    return url.toString(); // returns above URL, magically!:-)

Any help appreciated.


Bill

Re: YAURL Question (sending a Tapestry URL via email, with args)

Posted by Richard Lewis-Shell <rl...@mac.com>.
I would probably approach this by creating a "confirm" service for the
application where you can control the URL (almost) completely.  Then your
URL could be more like:

    http://www.foo.com/bar/app?service=confirm/31NP5SL24XRS1GB7XU

R

----- Original Message -----
From: "Bill Lear" <ra...@zopyra.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Thursday, June 12, 2003 12:57 PM
Subject: Re: YAURL Question (sending a Tapestry URL via email, with args)


> On , June 12, 2003 at 01:56:23 (+0300) Marilen Corciovei writes:
> >getEngine().getService("page").buildGesture(cycle, getPage(),
null).getAbsoluteURL();
>
> Thanks for the help.  It appears buildGesture() is a bit old.  I tried
> the following, using getLink():
>
>     String[] params = { "tk=31NP5SL24XRS1GB7XU" };
>
>     String URL =
>         getEngine().getService("page").getLink(cycle,
>                                                cycle.getPage("Confirm"),
>                                                params).getAbsoluteURL();
>
> but I get this resulting URL:
>
>     http://www.foo.com/bar/app?service=page/tk=31NP5SL24XRS1GB7XU
>
> There is no mention of the Confirm page in the above URL.  What I'm
> trying to get is:
>
>     http://www.foo.com/bar/app?service=page/Confirm&tk=31NP5SL24XRS1GB7XU
>
> I suppose I could "hard-code" this, as:
>
>     String[] params = { "Confirm&tk=31NP5SL24XRS1GB7XU" };
>
> but that seems a bit unkosher for some reason.
>
>
> Bill
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>



Re: YAURL Question (sending a Tapestry URL via email, with args)

Posted by Bill Lear <ra...@zopyra.com>.
On , June 12, 2003 at 01:56:23 (+0300) Marilen Corciovei writes:
>getEngine().getService("page").buildGesture(cycle, getPage(), null).getAbsoluteURL(); 

Thanks for the help.  It appears buildGesture() is a bit old.  I tried
the following, using getLink():

    String[] params = { "tk=31NP5SL24XRS1GB7XU" };

    String URL =
        getEngine().getService("page").getLink(cycle,
                                               cycle.getPage("Confirm"),
                                               params).getAbsoluteURL();

but I get this resulting URL:

    http://www.foo.com/bar/app?service=page/tk=31NP5SL24XRS1GB7XU

There is no mention of the Confirm page in the above URL.  What I'm
trying to get is:

    http://www.foo.com/bar/app?service=page/Confirm&tk=31NP5SL24XRS1GB7XU

I suppose I could "hard-code" this, as:

    String[] params = { "Confirm&tk=31NP5SL24XRS1GB7XU" };

but that seems a bit unkosher for some reason.


Bill

Re: YAURL Question (sending a Tapestry URL via email, with args)

Posted by Marilen Corciovei <le...@nemesisit.rdsnet.ro>.
getEngine().getService("page").buildGesture(cycle, getPage(),
null).getAbsoluteURL(); 

 

On Thu, 2003-06-12 at 01:31, Bill Lear wrote:
> All this hURLing about URLs has made me chURLish.
> 
> Suppose I have a register page, as such:
> 
>     http://www.foo.com/biff/app?service=action/1/Login/1/register
> 
> Suppose the page has an email field, and the user fills this in and
> hits submit.  I'd like to send them a confirmation email, to ensure
> that they provide a valid email address before they are allowed to
> become a confirmed user of the system.
> 
> In the email, I would like to send them a link that they can click on
> (or cut-n-paste).  The target page of this link will be a confirmation
> page, on which they will select a new password, hit enter, and be
> confirmed.
> 
> So, how would I do this?  I'd like the URL to be as simple as
> possible.  So, if I generate a unique confirmation token (tk) for the
> user, I'd like to send them something like this, perhaps:
> 
>     http://www.foo.com/buzz/app?service=page/Confirm&tk=31NP5SL24XRS1GB7XU
> 
> or some such.
> 
> I know how to grab the tk part of the URL once in the Confirm page,
> but how do I generate this URL in the first place, say from the
> Request cycle object.  What I'd like is (surprise) something simple:
> 
>     Confirm confirm = (Confirm) cycle.getPage("Confirm");
> 
>     URL url = confirm.getURL(); // ??
> 
>     url.addParameter("tk", "31NP5SL24XRS1GB7XU");
> 
>     return url.toString(); // returns above URL, magically!:-)
> 
> Any help appreciated.
> 
> 
> Bill
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
-- 
Marilen Corciovei <le...@nemesisit.rdsnet.ro>