I'm trying to take JSON values on POST method but I don't know how to do this.
This is the code that I have:
@POST
@Path("/contacts")
@Consumes({"application/json"})
public void addContact() {
HttpSession session = request.getSession(true);
UserPK user = new UserPK((String) session.getAttribute("username"));
//dest = TAKE JSON VALUE
dao.addContact(user, dest);
}
I'm sending the JSON value with firefox RestClient with this look:
{"param1":"value"}
How can I take this value?
We also have this error message: 415 Unsupported Media Type
Thanks.