コード例 #1
0
  public Response addCustomer(Customer customer) {
    System.out.println("----invoking addCustomer, Customer name is: " + customer.getName());
    customer.setId(++currentId);

    customers.put(customer.getId(), customer);

    return Response.ok(customer).build();
  }
コード例 #2
0
  public Response updateCustomer(Customer customer) {
    System.out.println("----invoking updateCustomer, Customer name is: " + customer.getName());
    Customer c = customers.get(customer.getId());
    Response r;
    if (c != null) {
      customers.put(customer.getId(), customer);
      r = Response.ok().build();
    } else {
      r = Response.notModified().build();
    }

    return r;
  }