You need to provide a separate resource for your single contact call. On 24 Jul 2012, at 13:59, Thierry LAU <la...@sfeir.com> wrote:
> I changed MyApplication code : > > @Override > public synchronized Restlet createInboundRoot(){ > > OAuthParameters p = new OAuthParameters("Client ID", "Client Secret", > OAUTH_BASE, Scopes.toRoles(ContactsResource.API_URI + " " + > ContactResource.API_URI)); > p.setAuthorizePath("auth"); > p.setAccessTokenPath("token"); > OAuthProxy op = new OAuthProxy(p, getContext().createChildContext()); > op.setNext(ContactsResource.class); > > Router root = new Router(getContext()); > root.attach("/contactsCallback", op); > root.attach("/contactCallback", op); > return root; > } > > This is the resources code : > > public class ContactResource extends ServerResource { > public static final String API_URI = > "https://www.google.com/m8/feeds/contacts/default/full/1766a4a8833d805"; > > @Get > public Representation getContacts(){ > OAuthUser u = (OAuthUser) getRequest().getClientInfo().getUser(); > String token = u.getAccessToken(); > Reference ref = new Reference(API_URI); > ref.addQueryParameter(OAuthServerResource.OAUTH_TOKEN, token); > ClientResource cr = new ClientResource(ref); > return cr.get(); > } > } > > public class ContactsResource extends ServerResource { > public static final String API_URI = > "https://www.google.com/m8/feeds/contacts/default/full"; > > @Get > public Representation getContacts(){ > OAuthUser u = (OAuthUser) getRequest().getClientInfo().getUser(); > String token = u.getAccessToken(); > Reference ref = new Reference(API_URI); > ref.addQueryParameter(OAuthServerResource.OAUTH_TOKEN, token); > ClientResource cr = new ClientResource(ref); > return cr.get(); > } > } > > > When I call /contactsCallback, I'm able to fetch my contact list > but whe I call /contactCallback to fetch One contact, it's the list of all my > contact which are returned (the same as the previous call) > > What am I doing wrong ? > > Thanks > > ------------------------------------------------------ > http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2992692 ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2992697