I have recently begun studyin the restlet interface. I don t know how to translate this method put using the restlet interface.
curl -X PUT http://ip:port/testdb2
How can I translate this request? So far , i have this code :
ClientResource resource = new ClientResource("http://"+this.ip+":5984/");
// Send the HTTP GET request
Representation r=resource.get();
if (resource.getStatus().isSuccess()) {
resource.getResponseEntity().write(System.out);
}
resource.put(null);
if (resource.getStatus().isSuccess()){
resource.getResponseEntity().write(System.out);
} else
System.out.println("Error put");
How do I specify the new url? I need this request to create a couchDB database.
Rephrasing your question, I'll use "How do I issue a PUT request to this url ..."
Per http://www.restlet.org/documentation/2.0/firstResource#part07
Perhaps something like
ClientResource dbResource = new ClientResource(
"http://"+this.ip+":5984/testdb2");
Representation r = dbResource.put(null);