For xml and json I know I can do this:
@POST
@Consumes({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
@Produces("text/plain")
public String post(Contact c)
{
return "got it";
}
@XmlRootElement(name="contact")
@XmlAccessorType(XmlAccessType.FIELD)
public class Contact {
.......
}
For FORM_URLENCODED, I have to do it in another way:
@POST
@Consumes({MediaType.APPLICATION_ FORM_URLENCODED})
public String post(@FormParam("identity_value") String identity,
@FormParam("identity_type") String type,
@FormParam("comment") String comment)
{
}
how can I combine them together in one method? Otherwise I have to
create 2 resource classes and each contains a post method?
Thanks!