Are there any docs on being able to POST JSON and having it create an object?
For example,
@POST
@Consumes("application/json")
public void doSomething(MyDomainObject do) {
log.debug("we have a domain object');
}
The client (python in my case) would
params = urllib.urlencode({"name":"somevalue","uuid":"someuuid"})
headers = {"Content-type":"application/json",
"Accept": "application/json"}
conn = httplib.HTTPConnection("localhost", 8080)
conn.request("POST", '/myurl/, params, headers)
response = conn.getresponse()
print("Status: %d Response: %s" % (response.status, response.reason))
rsp = response.read()
conn.close()
What I want to happen is the above JSON gets transformed into a MyDomainObject.
MyDomainObject is annotated right enough to have it serialized as JSON
in a GET method
but how do I do it the other way?
Sincerely,
jesus