Reputation: 50067
I have a restlet resource mapped as follows:
router.attach("/activities/{userid}/{criteria}/{value}", ActivitiesResource.class);
I am testing the resource from cmd line with curl and it works OK. Now I want to consume it from another resource. Looking at the documentation, I understand I should be able to do something like this:
// create client resource for the activities
ClientResource clientResource = new ClientResource("http://localhost:8888/myApp/activities/");
// wrap
IActivitiesResource activitiesResource = clientResource.wrap(IActivitiesResource.class);
// invoke a given method
JsonRepresentation result = activitiesResource.getActivites();
My question (assuming the above looks OK): how do I pass the parameters mapped in the url (userid, criteria, value) to the client resource?
Upvotes: 0
Views: 665
Reputation: 1600
Well you can add the parameters to the uri that you are passing to the ClientResource. for example:
ClientResource clientResource = new ClientResource("http://localhost:8888/myApp/activities/123/weight/70");
Hope that helps.
Upvotes: 1