You do not need an annotation. The only parameter without annotation will be the container for the request body:
@POST()
@Path("/{itemId}")
@Consumes(MediaType.APPLICATION_JSON)
public void addVote(@PathParam("itemId") Integer itemId, String body) {
voteDAO.create(new Vote(body));
}
or you can get the body already analyzed in the object:
@POST()
@Path("/{itemId}")
@Consumes(MediaType.APPLICATION_JSON)
public void addVote(@PathParam("itemId") Integer itemId, Vote vote) {
voteDAO.create(vote);
}
source
share