@Path("/confermaOrdine") @GET @Produces("application/json") public String confermaOrdine() throws ClassNotFoundException { MagazzinoMock mg = new MagazzinoMock(); ArrayList<ProdottoOrdinato> prodottiDaOrdinare = (ArrayList<ProdottoOrdinato>) request.getSession().getAttribute("carrello"); GestioneOrdini go = new GestioneOrdini(); Utente utente = (Utente) request.getSession().getAttribute("utente"); String codUser = utente.getCodUtente(); // cliente provvisorio double importo = 0; try { importo = go.acquisto(prodottiDaOrdinare, codUser); request.getSession().removeAttribute("carrello"); } catch (ErroreSistema e) { e.printStackTrace(); } Gson gs = new Gson(); System.out.println(gs); return gs.toJson(importo); }