I currently have this working with a roo generated project to pull json formatted objects from the server, works good using the jackson library:
Now I would like to push an edited object back up to the server and process it, does anyone have some suggestions for the best way to get this done? At first glance I was thinking I would have to create some custom server side code and pickup an HTTP post that contains the json and then invoke the objects to do the save back to the DB (assuming what I wanted to do was save, or whatever the server side operation is).Code:ObjectMapper mapper = new ObjectMapper(); mapper.configure(Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); MyWrappedClass wrapper = null; wrapper = mapper.readValue(new URL("http://10.0.2.2:8080/MyProject/MyClass.json"), MyWrappedClass.class);
A fantasy implementation at the client would look like:
Code:ObjectMapper mapper = new ObjectMapper(); string jsonValue = mapper.writeValueAsString(wrapper); rooServer.WriteJson(URL("http://10.0.2.2:8080/MyProject/MyClass.json"), jsonValue);


Reply With Quote