On Thu, Dec 30, 2010 at 10:29 AM, Charlie Mason <[email protected]> wrote: > 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; > } >
I have discovered that if you remove the media declaration it uses a different method which does actually send data in the request. r.put(requestRep); Thanks, Charlie M ------------------------------------------------------ http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2694901

