Before I started with Restlet I already wrote a Jersey client. It was very intutiv - it seems like Restlet isnt. There is not much documentation and I can't solve the easiest problems.
Where I am:
service = new ClientResource("http://localhost:8080/com-project-core/rest");
service.setChallengeResponse(ChallengeScheme.HTTP_BASIC, "admin", "geheima");
What I get from documentation:
String myString = service.get(String.class);
or wrapping up a Resource:
ConnectedResourceIF connectedResource = service.wrap(ConnectedResourceIF.class);
Thats working. But what about:
A. When I want to change my service path? In Jersey it was intuitiv like
service.path("foo").path("bar")
for
http://localhost:8080/com-project-core/rest/foo/bar
B. I want to set a acceptHeader. In jersey it was like
service.accept(MediaType.TEXT_PLAIN)
C. I want to set query parameters. In jersey:
service.queryParam("1","foo").queryParam("2","bar")
Sorry, hope someone can solve this beginner problems. I cant find somethign in the restlet documentation.
For A:
service.getChild("/foo/bar", ConnectedResourceIF.class);
For B (need a recent 2.1 RCx version):
service.accept(MediaType.TEXT_PLAIN);
For C (need a recent 2.1 RCx version):
service.setQueryValue("1","foo");
service.setQueryValue("2","bar");
The best place to look for such things is the Javadocs, because those API changes are pretty recent: http://www.restlet.org/documentation/snapshot/jee/api/org/restlet/resource/ClientResource.html
We are working on a new in-depth tutorial for next 2.2 version. First finishing "Restlet in Action" book :)