0

This is an example of a method:

updatePatientAddressByID(String ID, String address)

Any Help

  • Please do not cross-post with the Restlet mailing list... http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2951260 – Jerome Louvel Apr 24 '12 at 10:26

1 Answers1

0

You have to design your URL so that the Id is a path segment :

router.attach("/patients/{id}", PatientResource.class);

Then in your Restlet implementation, you can get this variable :

@Post
public void store(String address) {
    Long id = (Long) getRequest().getAttributes().get("id");
    ... do something with address ...
}
koma
  • 6,486
  • 2
  • 27
  • 53
  • every resource can accept each HTTP method at most ... this will depend on the structure of your resources... – koma Apr 25 '12 at 08:26
  • Do I have to make a separate resource class for it?? Because I already have a class which contains a method for addPatient.. Another question If I have a patient resource class which contains 4 methods: 1. AddPatient (Patient p) 2. DeletePatient (String ID) 3. RetrievePatient(String ID) 4.UpdatePatientAddress(String ID, String Address) Can I implement them in one resource class, if so how could I perform the server-side routing?? Thanks in advance, you are saving me.... – dalia sobhi Apr 27 '12 at 19:28