Ejemplo n.º 1
0
 @Override
 protected void doDelete(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   response.setContentType("application/json");
   try {
     StringBuilder sb = new StringBuilder();
     String s;
     while ((s = request.getReader().readLine()) != null) {
       sb.append(s);
       log.info("reading lines: " + s);
     }
     log.info("all the lines that have been read: " + sb);
     Level3 levelThree = gson.fromJson(sb.toString(), Level3.class);
     levelThreeDAO.delete(levelThree);
     response.getOutputStream().print(gson.toJson(levelThree));
     response.getOutputStream().flush();
     log.info(levelThree.toString());
     log.info("Result of attempt to Delete: ");
   } catch (Exception ex) {
     ex.printStackTrace();
     response.getOutputStream().print(gson.toJson("{'message' : 'failure'}"));
     response.getOutputStream().flush();
   }
 }