Hi everybody,
I'm trying to figure out how to handle a PUT on a resource. I have overriden
storeRepresentation method, so that it creates a new entity, and replies with
the passed entity. Here is the code :
@Override
public void storeRepresentation(Representation r) throws ResourceException {
try {
/* Create and store new resource */
getResponse().setStatus(Status.SUCCESS_CREATED);
getResponse().setEntity(r);
} catch (Exception e) {
throw new ResourceException(e);
}
}
@Override
public boolean allowPut() {
return true;
}
My problem is, if I build a client to put an entity on this resource, the
response contains an empty entity. Here is my test code :
Client client = new Client(Protocol.HTTP);
Request request = new Request(Method.PUT, "URL for the resource");
request.setEntity(new StringRepresentation("some data"));
Response response = client.handle(request);
System.out.println(response.getEntity());
This gives me "org.restlet.resource.representation$emptyrepresentat...@87e704".
Can someone explain me what I did wrong?
Thank you much,
Mathieu
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=1652124