Hi Everyone,
I have a general question with respect to the JAXB-JSON conversion that
takes place both inbound and outbound from resources.
On the outbound side every thing works well:
@GET
@Produces("application/json")
public List<Person> getPersons() {
log.info("getPersons entered");
final List<Person> persons = personService.getAll();
return persons;
}
But on the inbound side I have questions.
I have a simple method which I would like to send a JSON object to from an
html page. I haven't found an example of this being done in the Jersey
samples or through my Googling.
I'm not sure how I would pass this json object to this URI. Should the JSON
object be part of the path, sent as a parameter or either fine or still is
there another way (or maybe just don't do that!)?
@PUT
@Produces("text/plain")
@Consumes("application/json")
public String updatePerson(@QueryParam("person") final Person person) {
log.info("updatePerson entered: "+person.toString());
personService.update(person);
return "ok";
}
The JSON String I'm trying to send is: {"id":"1","name":"Frank
Zappa","age":"62"}
Any insights would be appreciated.
Thanks, David