@Test public void testRemoveStudent(){ Response response = target("/student").path("1").request().accept(MediaType.APPLICATION_JSON).delete(); System.out.println(response.getStatus()); System.out.println(response.readEntity(String.class)); }
@DELETE @Path("/{id}") public Response removeStudent(@PathParam("id") int id) { Student student = new Student(id,"SCOTT"); return Response.ok(student).build(); }
StudentRestService { @DELETE @Path("/{id}") public Response removeStudent(@PathParam("id") int id) { Student student = new Student(id,"SCOTT"); return Response.ok(student).build(); } }
StudentRestService { @DELETE @Path("/{id}") public Response removeStudent(@PathParam("id") int id) { Student student = new Student(id,"SCOTT"); return Response.ok(student).build(); }  }
StudentRestService { @DELETE @Path("/{id}") public Response removeStudent(@PathParam("id") int id) { Student student = new Student(id,"SCOTT"); return Response.ok(student).build(); }  @Path("/v1") @GET Response getStudentsV1(); @Path("/v2") @GET List<Student> getStudentsV2(); @Path("/v3") @GET Students getStudentsV3(); @Path("/v4") @GET Students getStudentsV4(@QueryParam("pageNumber")int pageNumber,@DefaultValue("20")@QueryParam("pageSize")int pageSize); @Path("/v5") @JSONP(callback="jsonp",queryParam="callback") @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON,"application/javascript"}) @GET Students getStudentsV5(@QueryParam("pageNumber")int pageNumber,@DefaultValue("20")@QueryParam("pageSize")int pageSize); @GET @Path("/json/{id}") @Produces(MediaType.APPLICATION_JSON) Response getStudentInJson(@PathParam("id") int id); @GET @Path("/jsonp/{id}") @JSONP(callback="jsonp",queryParam="callback") @Produces("application/javascript") Response getStudentInJsonp(@PathParam("id") int id); @GET @Path("/xml/{id}") @Produces(MediaType.APPLICATION_XML) Response getStudentInXml(@PathParam("id") int id); @GET @Path("/{id}") Response getStudentInfo(@PathParam("id") int id); @DELETE @Path("/{id}") Response removeStudent(@PathParam("id") int id); @POST Response saveStudent(Student student); @PUT Response updateStudent(Student student); }
StudentRestService { @DELETE @Path("/{id}") public Response removeStudent(@PathParam("id") int id) { Student student = new Student(id,"SCOTT"); return Response.ok(student).build(); }  @Path("/v1") @GET Response getStudentsV1(); @Path("/v2") @GET List<Student> getStudentsV2(); @Path("/v3") @GET Students getStudentsV3(); @Path("/v4") @GET Students getStudentsV4(@QueryParam("pageNumber")int pageNumber,@DefaultValue("20")@QueryParam("pageSize")int pageSize); @Path("/v5") @JSONP(callback="jsonp",queryParam="callback") @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON,"application/javascript"}) @GET Students getStudentsV5(@QueryParam("pageNumber")int pageNumber,@DefaultValue("20")@QueryParam("pageSize")int pageSize); @GET @Path("/json/{id}") @Produces(MediaType.APPLICATION_JSON) Response getStudentInJson(@PathParam("id") int id); @GET @Path("/jsonp/{id}") @JSONP(callback="jsonp",queryParam="callback") @Produces("application/javascript") Response getStudentInJsonp(@PathParam("id") int id); @GET @Path("/xml/{id}") @Produces(MediaType.APPLICATION_XML) Response getStudentInXml(@PathParam("id") int id); @GET @Path("/{id}") Response getStudentInfo(@PathParam("id") int id); @DELETE @Path("/{id}") Response removeStudent(@PathParam("id") int id); @POST Response saveStudent(Student student); @PUT Response updateStudent(Student student);  }