· 9 years ago · Jan 20, 2017, 08:22 PM
1@Path("/customer")
2public class CustomerServiceRest {
3
4 public CustomerServiceRest() {
5 }
6
7 @GET
8 @Path("/get/{idCustomer}")
9 @Produces(MediaType.TEXT_PLAIN)
10 public String getText(@PathParam("idCustomer") String idCustomer) {
11 Gson gson = new Gson();
12 // deserialize POST request if necessary
13 // Customer req = gson.fromJson(request, Customer.class);
14 String req = "/customer/get/" + idCustomer;
15 Customer cus = new Customer();
16 cus.setNome("Nome" + idCustomer);
17 cus.setCognome("Cognome" + idCustomer);
18 cus.setEmail("nome" + idCustomer + ".cognome" + idCustomer + "@gmail.com");
19 String res = gson.toJson(cus);
20 return res;
21 }
22
23}