You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Mayne, Peter" <Pe...@ap.spherion.com> on 2003/08/14 06:32:50 UTC

Getting visit + parameters in service()

I've written a service that provides a file download facility. In getLink(),
I can use

    Visit visit = (Visit)cycle.getPage().getVisit();

to get the visit object where I store the user's username. However, in
service(), cycle.getPage() returns null.

How do I get the visit object in service()?

Also in service(), I'm getting the single servicelink parameter I set with
constructLink() using

            cycle.getRequestContext().getParameter("sp");

I had to figure out the "sp" part by running the page and looking at the URL
that was produced, since I couldn't find this documented. Did I miss it, or
isn't it there?

Thanks.

PJDM
-- 
Peter Mayne
Technology Consultant
Spherion Technology Solutions
Level 1, 243 Northbourne Avenue, Lyneham, ACT, 2602
T: 61 2 62689727  F: 61 2 62689777

The information contained in this email and any attachments to it:

(a) may be confidential and if you are not the intended recipient, any interference with, 
use, disclosure or copying of this material is unauthorised and prohibited; and

(b) may contain personal information of the recipient and/or the sender as defined 
under the Privacy Act 1988 (Cth). Consent is hereby given by the recipient(s) to 
collect, hold and use such information and any personal information contained in a 
response to this email, for any reasonable purpose in the ordinary course of 
Spherion's 
business, including forwarding this email internally or disclosing it to a third party. All 
personal information collected by Spherion will be handled in accordance with 
Spherion's Privacy Policy. If you have received this email in error, please notify the 
sender and delete it.

(c) you agree not to employ or arrange employment for any candidate(s) supplied in 
this email and any attachments without first entering into a contractual agreement with 
Spherion. You further agree not to divulge any information contained in this document 
to any person(s) or entities without the express permission of Spherion.



Re: Getting visit + parameters in service()

Posted by Harish Krishnaswamy <hk...@comcast.net>.
If it is a custom service you will have to load the page (in the service 
method usually) using cycle.getPage("pageName"). The "pageName" is 
usually obtained from the encoded URL. You may also get the Visit from 
the engine using engine.getVisit() or engine.getVisit(IRequestCycle). 
The first method only returns a visit if it already exists and the 
second one creates a new visit if it does not already exist.

AbstractService has a method getParameters(IRequestCycle) that returns 
the parameters in the form of objects, cool huh!

-Harish

Mayne, Peter wrote:

> I've written a service that provides a file download facility. In 
> getLink(), I can use
>
>     Visit visit = (Visit)cycle.getPage().getVisit();
>
> to get the visit object where I store the user's username. However, in 
> service(), cycle.getPage() returns null.
>
> How do I get the visit object in service()?
>
> Also in service(), I'm getting the single servicelink parameter I set 
> with constructLink() using
>
>             cycle.getRequestContext().getParameter("sp");
>
> I had to figure out the "sp" part by running the page and looking at 
> the URL that was produced, since I couldn't find this documented. Did 
> I miss it, or isn't it there?
>
> Thanks.
>
> PJDM
> -- 
> Peter Mayne
> Technology Consultant
> Spherion Technology Solutions
> Level 1, 243 Northbourne Avenue, Lyneham, ACT, 2602
> T: 61 2 62689727  F: 61 2 62689777
>
>The information contained in this email and any attachments to it:
>
>(a) may be confidential and if you are not the intended recipient, any interference with, 
>use, disclosure or copying of this material is unauthorised and prohibited; and
>
>(b) may contain personal information of the recipient and/or the sender as defined 
>under the Privacy Act 1988 (Cth). Consent is hereby given by the recipient(s) to 
>collect, hold and use such information and any personal information contained in a 
>response to this email, for any reasonable purpose in the ordinary course of 
>Spherion's 
>business, including forwarding this email internally or disclosing it to a third party. All 
>personal information collected by Spherion will be handled in accordance with 
>Spherion's Privacy Policy. If you have received this email in error, please notify the 
>sender and delete it.
>
>(c) you agree not to employ or arrange employment for any candidate(s) supplied in 
>this email and any attachments without first entering into a contractual agreement with 
>Spherion. You further agree not to divulge any information contained in this document 
>to any person(s) or entities without the express permission of Spherion.
>
>
>  
>
>------------------------------------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>