Hi everybody,
  I have a problem using POST with REST. I do POST this way:

ClientResource r2 = new ClientResource("/api/rest/serverReceiveUser");

                                    JSONObject objeto=new JSONObject();
                                    objeto.put("email", new JSONString("b"));
                                    objeto.put("name", new 
JSONString("Beatriz"));
                                    objeto.put("nick", new JSONString("bea"));
                                    objeto.put("perfil", new JSONNumber(2));


                                    r2.setOnResponse(new Uniform() {
                                                @Override
                                public void handle(org.restlet.client.Request 
request,
                                                org.restlet.client.Response 
response) {
                                         try {

                                        Window.alert("POST
Response:"+response.getEntity().getText());
                                    } catch (Exception e) {
                                         e.printStackTrace();
                                    }

                                }
                    });

r2.post(objeto, MediaType.APPLICATION_JSON);




I get the POST call:

public class ServerReceiveUserResource extends ServerResource {

        @Post ("json")
        public String represent(JSONObject objeto){

                try{
                        String email=objeto.get("email").toString();
                        return email;

                }catch (Exception e){
                        log.error(e.toString());
                }
                return null;
        }
...


But, the JSONObject I receive is null, because in the class
ClientResource.java there's a function that always returns a null
value:


 /**
     * Converts an object into a representation based on client
preferences.
     *
     * @param source
     *            The object to convert.
     * @return The wrapper representation.
     */
    protected Representation toRepresentation(Object source) {
        Representation result = null;

        if (source != null) {
        }

        return result;
    }


What should I do to get this working??
Thanks in advance,
  Mikel



-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to