01: package org.claros.intouch.tasks.services;
02:
03: import java.io.IOException;
04: import java.io.PrintWriter;
05:
06: import javax.servlet.ServletException;
07: import javax.servlet.http.HttpServletRequest;
08: import javax.servlet.http.HttpServletResponse;
09:
10: import org.claros.intouch.common.services.BaseService;
11: import org.claros.intouch.tasks.controllers.TaskController;
12:
13: public class DeleteTaskService extends BaseService {
14: private static final long serialVersionUID = -5951734614553525154L;
15:
16: /**
17: * @param request
18: * the request send by the client to the server
19: * @param response
20: * the response send by the server to the client
21: * @throws ServletException
22: * if an error occurred
23: * @throws IOException
24: * if an error occurred
25: */
26: public void doPost(HttpServletRequest request,
27: HttpServletResponse response) throws ServletException,
28: IOException {
29: response.setHeader("Expires", "-1");
30: response.setHeader("Pragma", "no-cache");
31: response.setHeader("Cache-control", "no-cache");
32: response.setHeader("Content-Type", "text/html; charset=utf-8");
33: PrintWriter out = response.getWriter();
34:
35: String sId = request.getParameter("id");
36:
37: if (sId != null) {
38: try {
39: TaskController.deleteTask(getAuthProfile(request)
40: .getUsername(), new Long(sId));
41: out.print("ok");
42: } catch (Exception e) {
43: out.print("fail");
44: }
45: } else {
46: out.print("fail");
47: }
48: }
49:
50: }
|