Hi All,
I am trying to get a put request working via the GWT api. The bellow
code generates a put request but there is not Representation included
only the HTTP headers. At the moment I am just trying to get some data
exchanged between the client and the server rather than worrying about
the actual JSON serialisation.
ClientResource r = new ClientResource("/api/eo/pages/" +
page.getId());
// Set the callback object invoked when the response is
received.
r.setOnResponse(new Uniform() {
public void handle(Request request, Response response)
{
try
{
String eoText =
response.getEntity().getText();
Window.alert("Response: " + eoText);
} catch (IOException e)
{
e.printStackTrace();
}
}
});
StringRepresentation requestRep = new StringRepresentation(new
JSONObject(page).toString(), MediaType.APPLICATION_JSON);
r.put(requestRep, MediaType.APPLICATION_JSON);
Following it through with the Debuger the put request ends up
executing the below method from the Uniform resource class.
protected Representation toRepresentation(Object source, Variant target) {
Representation result = null;
if (source != null) {
}
return result;
}
As you can see it will always return a null Representation hence why
there is no data being sent in the HTTP request.
What am I doing wrong?
Thanks,
Charlie M
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2694869