示例#1
0
 @PUT
 @Path("/{id:[0-9][0-9]*}")
 @Consumes(MediaType.APPLICATION_JSON)
 public Response update(@PathParam("id") Long id, Vendor entity) {
   entity.setId(id);
   entity = em.merge(entity);
   return Response.noContent().build();
 }
示例#2
0
 @POST
 @Consumes(MediaType.APPLICATION_JSON)
 public Response create(Vendor entity) {
   em.persist(entity);
   return Response.created(
           UriBuilder.fromResource(VendorEndpoint.class)
               .path(String.valueOf(entity.getId()))
               .build())
       .build();
 }