Esempio n. 1
0
 @Path("")
 @GET
 @Produces(MediaType.APPLICATION_XML)
 @Formatted
 public Response getBank() {
   log.debug("{} {}", request.getMethod(), uriInfo.getRequestUri());
   Bank bank = service.getBank();
   URI self = new BankRefs(uriInfo).setHRefs(bank);
   log.debug("returning bank:\n{}", bank.toXML());
   return Response.ok(bank, MediaType.APPLICATION_XML)
       .contentLocation(self)
       .lastModified(bank.getUpdated())
       .build();
 }
Esempio n. 2
0
 @Path("")
 @PUT
 @Consumes(MediaType.APPLICATION_XML)
 public Response updateBank(Bank bank) {
   log.debug("{} {}", request.getMethod(), uriInfo.getRequestUri());
   if (service.updateBank(bank) == 0) {
     log.debug("updated bank:\n{}", bank.toXML());
     return Response.noContent().build();
   } else {
     return Response.status(Status.BAD_REQUEST)
         .entity(String.format("cannot update bank"))
         .type(MediaType.TEXT_PLAIN)
         .build();
   }
 }