jeudi 2 avril 2015

Retrieving resource id in Restlet

what's the Restlet equivalent of the following snippet of code I'm using with Jersey:



@GET
@Path("{id}")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON,MediaType.TEXT_XML})
public Todo getEntityXMLOrJSON(@PathParam("id") int id)
{
...
}


I mean, when using Restlet framework I do the following:



public class ContactsApplication extends Application {
public Restlet createInboundRoot() {
Router router = new Router(getContext());
router.attach("/contacts/{contactId}", ContactServerResource.class);
return router;
}
}


how do I retrieve contactId in the get method ?





Aucun commentaire:

Enregistrer un commentaire