If I wrote this in createbound method:
Restlet retrievepatient = new Restlet(getContext()) {
@Override
public void handle(Request request, Response response) {
patientResource = new PatientResource();
//Save patient's ID from the request
String patientID = (String)
request.getAttributes().get("patient");
System.out.println(patientID);
String message = patientResource.retrievePatient(patientID);
System.out.println(message);
//Response
response.setEntity(message,MediaType.TEXT_PLAIN);
}
};
// Create the addpatient's handler
Restlet addPatient = new Restlet(getContext()) {
@Override
public void handle(Request request, Response response) {
patientResource = new PatientResource();
Patient p = new Patient();
p =(Patient)request.getAttributes().get("patient");
patientResource.addPatient(p);
System.out.println("Patient Added");
//Response
//response.setEntity(message,MediaType.TEXT_PLAIN);
}
};
router.attach("/{patient}/retrievepatient", retrievepatient);
router.attach("/Patient/AddPatient",addPatient);
I get the following errors:
A recoverable error was detected (1001), attempting again in 2000 ms.
//I am in an infinite loop
--
View this message in context:
http://restlet-discuss.1400322.n2.nabble.com/Restlet-Methods-tp7490099p7491146.html
Sent from the Restlet Discuss mailing list archive at Nabble.com.
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2951138