如果传入的是对象用的post传输方式 就用@POST
1 @POST 2 @Path("deteleActivity") 3 @Consumes(MediaType.APPLICATION_JSON) 4 public Response deteleActivity(JSONObject activityJson){ 5 Activity activity=new Gson().fromJson(activityJson.toString(), Activity.class); 6 activityLogic.deteleActivity(activity); 7 return Response.ok().build(); 8 }
如果传入的是用get方式数据在url上就用@GET
1 @GET 2 @Path("deleteActivitiesByWorkgroupId/{workgroupId}") 3 @Consumes(MediaType.APPLICATION_JSON) 4 public Response deleteActivitiesByWorkgroupId(@PathParam("workgroupId") int workgroupId){ 5 activityLogic.deleteActivitiesByWorkgroupId(workgroupId); 6 return Response.ok().build(); 7 } 8
没有数据返回用@Consumes
有数据返回用@Produces