【发布时间】:2015-04-26 14:14:32
【问题描述】:
我是初学者,我会知道如何使用put方法让用户可以添加数据,我使用restful架构,java,json和apache这里是我测试的代码,我希望找到答案在这里谢谢你
@PUT
//path
@Path("/carte")
//json form
@Produces("application/json; charset=UTF-8")
@PermitAll
public List<Carte> setAllCarte(@FormParam ("nom") String nom , @FormParam("prenom") String prenom , @FormParam("date") Integer date ,
@FormParam("compte") Integer compte);
//implimante the list with a json data
public List<Carte> setAllCarte(String nom, String prenom, Integer date,
Integer compte) {
Carte list = new Carte();
list.setNom(nom);
list.setPrenom(prenom);
list.setDate(date);
list.setCompte(compte);
return setAllCarte(nom, prenom, date, compte);
}
【问题讨论】:
标签: java json web-services rest put