Hello,
actually you can't achieve what you want this way.
Parameters located on server resources are dedicated to the enclosed entity of
the incoming request. For example, the entity of a POST or a PUT request.
This can't apply to GET requests since GET request have no enclosed entity.
One way is to declare a URI template for the Contact resource :
// 1- attach the Contact resource to the URI template (note the "contactId"
pattern)
router.attach("/contacts/{contactId}", ContactServerResource.class);
//2- The Contact resource can retrieve the "contactId" variable either in the
annotated method:
@Get
public Contact retrieve() {
String contactId = (String) getRequestAttributes("contactId");
return (Contact)db.GqlQuery(...);
}
or in the doInit method:
public class ContactServerResource extends ServerResource implements
ContactResource {
private Contact contact;
public void doInit(){
String contactId = (String) getRequestAttributes("contactId");
contact = (Contact)db.GqlQuery(...);
setExisting(contact!=null);
}
@Get
public Contact retrieve() {
return contact;
}
}
I hope this will help you. I think I will change the sample code in order to
evoke the URI templates.
Best regards,
Thierry Boileau
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2649254