Hi Niklas,

One of the arguments of the service() method is an IRequestCycle. Using it, you can implement all of what you need.

To get the Visit:

cycle.getEngine().getVisit()

Please note that IEngine.getVisit() does NOT create a new Visit if it does not exist (unlike page.getVisit()), so you will get null if the visit does not exist (it seems that this is what you want anyway).

To switch to another page, you can use the same method in service() as in validate(): throw a PageRedirectException.

I hope this helps.

-mb

 

 Niklas Ekman <[EMAIL PROTECTED]> wrote:

Hello!
 
I've created a service that services documents from a database (I used the ChartService as a base for my service).
 
Now, if a user gets hold of the service link, I want to be able to check and see if the visit object is created, and if the user has access to the record in the database. If the user isn't logged in, I want to present a login page and then when the user has logged in, go to the service link originally asked for.
 
When I want this functionallity for pages I implement a validate() function in the page class and use the callback functionallity (like in the VLib project). How can I do the same for my service?
 
thanks,
 
Niklas

niklas.ekman
citat solutions | phone +46 (0)31 710 72 12
kronhusgatan 9, SE-411 05 g�teborg, sweden,
[EMAIL PROTECTED]

 



Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now

Reply via email to